# Manifest

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/java/util/jar/Manifest#pubctors)\|[Methods](https://developer.android.com/reference/java/util/jar/Manifest#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/util/jar/Manifest#inhmethods)  

# Manifest

`
public


class
Manifest
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Cloneable](https://developer.android.com/reference/java/lang/Cloneable)`


`

|---|------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.jar.Manifest |

<br />

*** ** * ** ***

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://docs.oracle.com/en/java/javase/17/docs/specs/jar/jar.html).  
**See also:**

- [Attributes](https://developer.android.com/reference/java/util/jar/Attributes)

## Summary

|                                                                                                                          ### Public constructors                                                                                                                           ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Manifest](https://developer.android.com/reference/java/util/jar/Manifest#Manifest())`() ` Constructs a new, empty Manifest.                                                                                                                                         |
| ` `[Manifest](https://developer.android.com/reference/java/util/jar/Manifest#Manifest(java.io.InputStream))`(`[InputStream](https://developer.android.com/reference/java/io/InputStream)` is) ` Constructs a new Manifest from the specified input stream.              |
| ` `[Manifest](https://developer.android.com/reference/java/util/jar/Manifest#Manifest(java.util.jar.Manifest))`(`[Manifest](https://developer.android.com/reference/java/util/jar/Manifest)` man) ` Constructs a new Manifest that is a copy of the specified Manifest. |

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

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Manifest

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Manifest ()
```

Constructs a new, empty Manifest.

<br />

### Manifest

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Manifest (InputStream is)
```

Constructs a new Manifest from the specified input stream.

<br />

|                              Parameters                               ||
|------|-----------------------------------------------------------------|
| `is` | `InputStream`: the input stream containing manifest data <br /> |

|                                                  Throws                                                  ||
|----------------------------------------------------------------------------|------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException) | if an I/O error has occurred |

### Manifest

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Manifest (Manifest man)
```

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

<br />

|                   Parameters                   ||
|-------|-----------------------------------------|
| `man` | `Manifest`: the Manifest to copy <br /> |

## Public methods

### clear

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void clear ()
```

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

<br />

### clone

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Object clone ()
```

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

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

<br />

<br />

|                                                  Returns                                                   ||
|--------------------------------------------------------------------|----------------------------------------|
| [Object](https://developer.android.com/reference/java/lang/Object) | a shallow copy of this Manifest <br /> |

### equals

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean equals (Object o)
```

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

<br />

|                   Parameters                    ||
|-----|--------------------------------------------|
| `o` | `Object`: the object to be compared <br /> |

|                                                    Returns                                                     ||
|-----------|-----------------------------------------------------------------------------------------------------|
| `boolean` | true if the specified Object is also a Manifest and has the same main Attributes and entries <br /> |

### getAttributes

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Attributes getAttributes (String 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[getEntries()](https://developer.android.com/reference/java/util/jar/Manifest#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[getMainAttributes()](https://developer.android.com/reference/java/util/jar/Manifest#getMainAttributes()).

<br />

|             Parameters              ||
|--------|-----------------------------|
| `name` | `String`: entry name <br /> |

|                                                              Returns                                                               ||
|--------------------------------------------------------------------------------|----------------------------------------------------|
| [Attributes](https://developer.android.com/reference/java/util/jar/Attributes) | the Attributes for the specified entry name <br /> |

### getEntries

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Map<String, Attributes> 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[read(InputStream)](https://developer.android.com/reference/java/util/jar/Manifest#read(java.io.InputStream)), nor is such an entry written by using[write(OutputStream)](https://developer.android.com/reference/java/util/jar/Manifest#write(java.io.OutputStream)).

<br />

|                                                                                                                                    Returns                                                                                                                                     ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
| [Map](https://developer.android.com/reference/java/util/Map)`<`[String](https://developer.android.com/reference/java/lang/String)`, `[Attributes](https://developer.android.com/reference/java/util/jar/Attributes)`>` | a Map of the entries contained in this Manifest <br /> |

### getMainAttributes

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Attributes getMainAttributes ()
```

Returns the main Attributes for the Manifest.

<br />

|                                                           Returns                                                           ||
|--------------------------------------------------------------------------------|---------------------------------------------|
| [Attributes](https://developer.android.com/reference/java/util/jar/Attributes) | the main Attributes for the Manifest <br /> |

### hashCode

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int hashCode ()
```

Returns the hash code for this Manifest.

<br />

|                     Returns                      ||
|-------|-------------------------------------------|
| `int` | a hash code value for this object. <br /> |

### read

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void read (InputStream is)
```

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

<br />

|                  Parameters                  ||
|------|----------------------------------------|
| `is` | `InputStream`: the input stream <br /> |

|                                                  Throws                                                  ||
|----------------------------------------------------------------------------|------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException) | if an I/O error has occurred |

### write

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void write (OutputStream out)
```

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

<br />

|                   Parameters                    ||
|-------|------------------------------------------|
| `out` | `OutputStream`: the output stream <br /> |

|                                                  Throws                                                  ||
|----------------------------------------------------------------------------|------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException) | if an I/O error has occurred |

**See also:**

- [getMainAttributes()](https://developer.android.com/reference/java/util/jar/Manifest#getMainAttributes())