java.lang.Object
java.util.jar.Manifest
- All Implemented Interfaces:
- Cloneable
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.
- Since:
- 1.2
- External Specifications
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionManifest()Constructs a new, empty Manifest.Manifest(InputStream is) Constructs a new Manifest from the specified input stream.Constructs a new Manifest that is a copy of the specified Manifest.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Clears the main Attributes as well as the entries in this Manifest.clone()Returns a shallow copy of this Manifest.booleanReturns true if the specified Object is also a Manifest and has the same main Attributes and entries.getAttributes(String name) Returns the Attributes for the specified entry name.Returns a Map of the entries contained in this Manifest.Returns the main Attributes for the Manifest.inthashCode()Returns the hash code for this Manifest.voidread(InputStream is) Reads the Manifest from the specified InputStream.voidwrite(OutputStream out) Writes the Manifest to the specified OutputStream.
- 
Constructor Details- 
Manifestpublic Manifest()Constructs a new, empty Manifest.
- 
ManifestConstructs a new Manifest from the specified input stream.- Parameters:
- is- the input stream containing manifest data
- Throws:
- IOException- if an I/O error has occurred
 
- 
ManifestConstructs a new Manifest that is a copy of the specified Manifest.- Parameters:
- man- the Manifest to copy
 
 
- 
- 
Method Details- 
getMainAttributesReturns the main Attributes for the Manifest.- Returns:
- the main Attributes for the Manifest
 
- 
getEntriesReturns 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 thenullkey, but no entry with a null key is created byread(java.io.InputStream), nor is such an entry written by usingwrite(java.io.OutputStream).- Returns:
- a Map of the entries contained in this Manifest
 
- 
getAttributesReturns the Attributes for the specified entry name. This method is defined as:return (Attributes)getEntries().get(name)Thoughnullis a validname, whengetAttributes(null)is invoked on aManifestobtained from a jar file,nullwill be returned. While jar files themselves do not allownull-named attributes, it is possible to invokegetEntries()on aManifest, and on that result, invokeputwith a null key and an arbitrary value. Subsequent invocations ofgetAttributes(null)will return the just-putvalue.Note that this method does not return the manifest's main attributes; see getMainAttributes().- Parameters:
- name- entry name
- Returns:
- the Attributes for the specified entry name
 
- 
clearpublic void clear()Clears the main Attributes as well as the entries in this Manifest.
- 
writeWrites 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- if an I/O error has occurred
- See Also:
 
- 
readReads 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- if an I/O error has occurred
 
- 
equalsReturns true if the specified Object is also a Manifest and has the same main Attributes and entries.
- 
hashCodepublic int hashCode()Returns the hash code for this Manifest.
- 
cloneReturns a shallow copy of this Manifest. The shallow copy is implemented as follows:public Object clone() { return new Manifest(this); }
 
-