# Manifest

public class **Manifest** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Cloneable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Cloneable.html) The Manifest class is used to maintain Manifest entry names and their
associated Attributes. There are main Manifest Attributes as well as
per-entry Attributes. For information on the Manifest format, please
see the
[Manifest format specification](https://developers.google.com/j2objc/javadoc/jre/technotes/guides/jar/jar.html).

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Attributes.html`

### Public Constructor Summary

|---|---|
|   | [Manifest](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#Manifest())() Constructs a new, empty Manifest. |
|   | [Manifest](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#Manifest(java.io.InputStream))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) is) Constructs a new Manifest from the specified input stream. |
|   | [Manifest](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#Manifest(java.util.jar.Manifest))([Manifest](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html) man) Constructs a new Manifest that is a copy of the specified Manifest. |

### Public Method Summary

|---|---|
| void | [clear](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#clear())() Clears the main Attributes as well as the entries in this Manifest. |
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#clone())() Returns a shallow copy of this Manifest. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o) Returns true if the specified Object is also a Manifest and has the same main Attributes and entries. |
| [Attributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Attributes.html) | [getAttributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#getAttributes(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Returns the Attributes for the specified entry name. |
| [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [Attributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Attributes.html)\> | [getEntries](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#getEntries())() Returns a Map of the entries contained in this Manifest. |
| [Attributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Attributes.html) | [getMainAttributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#getMainAttributes())() Returns the main Attributes for the Manifest. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#hashCode())() Returns the hash code for this Manifest. |
| void | [read](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#read(java.io.InputStream))([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) is) Reads the Manifest from the specified InputStream. |
| void | [write](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#write(java.io.OutputStream))([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) out) Writes the Manifest to the specified OutputStream. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**Manifest**
()

Constructs a new, empty Manifest.

#### public
**Manifest**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) is)

Constructs a new Manifest from the specified input stream.

##### Parameters

| is | the input stream containing manifest data |
|---|---|

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error has occurred |
|---|---|

#### public
**Manifest**
([Manifest](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html) man)

Constructs a new Manifest that is a copy of the specified Manifest.

##### Parameters

| man | the Manifest to copy |
|---|---|

## Public Methods

#### public void
**clear**
()

Clears the main Attributes as well as the entries in this Manifest.

#### public [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**clone**
()

Returns a shallow copy of this Manifest. The shallow copy is
implemented as follows:

```
     public Object clone() { return new Manifest(this); }
 
```

<br />

##### Returns

- a shallow copy of this Manifest

#### public boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) o)

Returns true if the specified Object is also a Manifest and has
the same main Attributes and entries.

##### Parameters

| o | the object to be compared |
|---|---|

##### Returns

- true if the specified Object is also a Manifest and has the same main Attributes and entries

#### public [Attributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Attributes.html)
**getAttributes**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Returns the Attributes for the specified entry name.
This method is defined as:

```
      return (Attributes)getEntries().get(name)
 
```
Though `null` is a valid `name`, when `getAttributes(null)` is invoked on a `Manifest` obtained from a jar file, `null` will be returned. While jar files themselves do not allow `null`-named attributes, it is possible to invoke `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#getEntries()` on a `Manifest`, and on that result, invoke `put` with a null key and an arbitrary value. Subsequent invocations of `getAttributes(null)` will return the just-`put` value.


Note that this method does not return the manifest's main attributes;
see `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#getMainAttributes()`.

##### Parameters

| name | entry name |
|---|---|

##### Returns

- the Attributes for the specified entry name

#### public [Map](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Map.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html), [Attributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Attributes.html)\>
**getEntries**
()

Returns a Map of the entries contained in this Manifest. Each entry
is represented by a String name (key) and associated Attributes (value).
The Map permits the `null` key, but no entry with a null key is
created by `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#read(java.io.InputStream)`, nor is such an entry written by using `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#write(java.io.OutputStream)`.

##### Returns

- a Map of the entries contained in this Manifest

#### public [Attributes](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Attributes.html)
**getMainAttributes**
()

Returns the main Attributes for the Manifest.

##### Returns

- the main Attributes for the Manifest

#### public int
**hashCode**
()

Returns the hash code for this Manifest.

##### Returns

- this object's hash code.

#### public void
**read**
([InputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/InputStream.html) is)

Reads the Manifest from the specified InputStream. The entry
names and attributes read will be merged in with the current
manifest entries.

##### Parameters

| is | the input stream |
|---|---|

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error has occurred |
|---|---|

#### public void
**write**
([OutputStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/OutputStream.html) out)

Writes the Manifest to the specified OutputStream.
Attributes.Name.MANIFEST_VERSION must be set in
MainAttributes prior to invoking this method.

##### Parameters

| out | the output stream |
|---|---|

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | if an I/O error has occurred |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/jar/Manifest.html#getMainAttributes()`