Build 1.0_r1(from source)

java.util.jar
Class Manifest

java.lang.Object
  extended by java.util.jar.Manifest
All Implemented Interfaces:
Cloneable

public class Manifest
extends Object
implements Cloneable

The Manifest class is used to obtain attribute information for a JarFile and its entries.


Constructor Summary
Manifest()
          Constructs a new Manifest instance.
Manifest(InputStream is)
          Constructs a new Manifest instance using the attributes obtained from is.
Manifest(InputStream is, boolean readChunks)
           
Manifest(Manifest man)
          Constructs a new Manifest instance.
 
Method Summary
 void clear()
          Resets the both the mainAttributes as well as the entry Attributes associated with this Manifest.
 Object clone()
          Creates a copy of this Manifest.
 boolean equals(Object o)
          Determines if the receiver is equal to the parameter Object.
 Attributes getAttributes(String name)
          Returns the Attributes associated with the parameter entry name
(package private)  byte[] getChunk(String name)
           
 Map<String,Attributes> getEntries()
          Returns a Map containing the Attributes for each entry in the Manifest.
 Attributes getMainAttributes()
          Returns the main Attributes of the JarFile.
(package private)  byte[] getMainAttributesChunk()
           
 int hashCode()
          Returns the hashCode for this instance.
 void read(InputStream is)
          Constructs a new Manifest instance obtaining Attribute information from the parameter InputStream.
(package private)  void removeChunks()
           
(package private) static void write(Manifest manifest, OutputStream out)
          Writes out the attribute information of the receiver to the specified OutputStream
 void write(OutputStream os)
          Writes out the attribute information of the receiver to the specified OutputStream
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Manifest

public Manifest()
Constructs a new Manifest instance.


Manifest

public Manifest(InputStream is)
         throws IOException
Constructs a new Manifest instance using the attributes obtained from is.

Parameters:
is - InputStream to parse for attributes
Throws:
IOException - if an IO error occurs while creating this Manifest

Manifest

public Manifest(Manifest man)
Constructs a new Manifest instance. The new instance will have the same attributes as those found in the parameter Manifest.

Parameters:
man - Manifest instance to obtain attributes from

Manifest

Manifest(InputStream is,
         boolean readChunks)
   throws IOException
Throws:
IOException
Method Detail

clear

public void clear()
Resets the both the mainAttributes as well as the entry Attributes associated with this Manifest.


getAttributes

public Attributes getAttributes(String name)
Returns the Attributes associated with the parameter entry name

Parameters:
name - The name of the entry to obtain Attributes for.
Returns:
The Attributes for the entry or null if the entry does not exist.

getEntries

public Map<String,Attributes> getEntries()
Returns a Map containing the Attributes for each entry in the Manifest.

Returns:
A Map of entry attributes

getMainAttributes

public Attributes getMainAttributes()
Returns the main Attributes of the JarFile.

Returns:
Main Attributes associated with the source JarFile

clone

public Object clone()
Creates a copy of this Manifest. The returned Manifest will equal the Manifest from which it was cloned.

Overrides:
clone in class Object
Returns:
A copy of the receiver.

write

public void write(OutputStream os)
           throws IOException
Writes out the attribute information of the receiver to the specified OutputStream

Parameters:
os - The OutputStream to write to.
Throws:
IOException - If an error occurs writing the Manifest

read

public void read(InputStream is)
          throws IOException
Constructs a new Manifest instance obtaining Attribute information from the parameter InputStream.

Parameters:
is - The InputStream to read from
Throws:
IOException - If an error occurs reading the Manifest.

hashCode

public int hashCode()
Returns the hashCode for this instance.

Overrides:
hashCode in class Object
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. Two Manifests are equal if they have identical main Attributes as well as identical entry Attributes.

Overrides:
equals in class Object
Parameters:
o - The Object to compare against.
Returns:
true if the manifests are equal, false otherwise
See Also:
Object.hashCode()

getChunk

byte[] getChunk(String name)

removeChunks

void removeChunks()

getMainAttributesChunk

byte[] getMainAttributesChunk()

write

static void write(Manifest manifest,
                  OutputStream out)
           throws IOException
Writes out the attribute information of the receiver to the specified OutputStream

Parameters:
manifest - the attribute information of the receiver
out - The OutputStream to write to.
Throws:
IOException - If an error occurs writing the Manifest

Build 1.0_r1(from source)

Please submit a feedback, bug or feature