Package java.util.jar
Class Manifest
- java.lang.Object
-
- java.util.jar.Manifest
-
-
Constructor Summary
Constructors Constructor Description Manifest()Creates a newManifestinstance.Manifest(InputStream is)Creates a newManifestinstance using the attributes obtained from the input stream.Manifest(Manifest man)Creates a newManifestinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Resets the both the main attributes as well as the entry attributes associated with thisManifest.Objectclone()Creates a copy of thisManifest.booleanequals(Object o)Determines if the receiver is equal to the parameter object.AttributesgetAttributes(String name)Returns theAttributesassociated with the parameter entryname.Map<String,Attributes>getEntries()Returns a map containing theAttributesfor each entry in theManifest.AttributesgetMainAttributes()Returns the mainAttributesof theJarFile.inthashCode()Returns the hash code for this instance.voidread(InputStream is)Merges name/attribute pairs read from the input streamisinto this manifest.voidwrite(OutputStream os)Writes thisManifest's name/attributes pairs to the givenOutputStream.
-
-
-
Constructor Detail
-
Manifest
public Manifest()
Creates a newManifestinstance.
-
Manifest
public Manifest(InputStream is) throws IOException
Creates a newManifestinstance using the attributes obtained from the input stream.- Parameters:
is-InputStreamto parse for attributes.- Throws:
IOException- if an IO error occurs while creating thisManifest
-
Manifest
public Manifest(Manifest man)
Creates a newManifestinstance. The new instance will have the same attributes as those found in the parameterManifest.- Parameters:
man-Manifestinstance to obtain attributes from.
-
-
Method Detail
-
clear
public void clear()
Resets the both the main attributes as well as the entry attributes associated with thisManifest.
-
getAttributes
public Attributes getAttributes(String name)
Returns theAttributesassociated with the parameter entryname.- Parameters:
name- the name of the entry to obtainAttributesfrom.- Returns:
- the Attributes for the entry or
nullif the entry does not exist.
-
getEntries
public Map<String,Attributes> getEntries()
Returns a map containing theAttributesfor each entry in theManifest.- Returns:
- the map of entry attributes.
-
getMainAttributes
public Attributes getMainAttributes()
Returns the mainAttributesof theJarFile.- Returns:
- main
Attributesassociated with the sourceJarFile.
-
clone
public Object clone()
Creates a copy of thisManifest. The returnedManifestwill equal theManifestfrom which it was cloned.
-
write
public void write(OutputStream os) throws IOException
Writes thisManifest's name/attributes pairs to the givenOutputStream. TheMANIFEST_VERSIONorSIGNATURE_VERSIONattribute must be set before calling this method, or no attributes will be written.- Throws:
IOException- If an error occurs writing theManifest.
-
read
public void read(InputStream is) throws IOException
Merges name/attribute pairs read from the input streamisinto this manifest.- Parameters:
is- TheInputStreamto read from.- Throws:
IOException- If an error occurs reading the manifest.
-
hashCode
public int hashCode()
Returns the hash code for this instance.- Overrides:
hashCodein classObject- Returns:
- this
Manifest's hashCode. - See Also:
Object.equals(java.lang.Object)
-
equals
public boolean equals(Object o)
Determines if the receiver is equal to the parameter object. TwoManifests are equal if they have identical main attributes as well as identical entry attributes.- Overrides:
equalsin classObject- Parameters:
o- the object to compare against.- Returns:
trueif the manifests are equal,falseotherwise- See Also:
Object.hashCode()
-
-