站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class Manifest - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

java.util.jar
Class Manifest

java.lang.Object
  |
  +--java.util.jar.Manifest

public class Manifest
extends Object
implements 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. Documentation on the Manifest format can be found at :

 http://java.sun.com/products/jdk/1.2/docs/guide/jar/manifest.html
 

Since:
JDK1.2
See Also:
Attributes

Constructor Summary
Manifest()
          Constructs a new, empty Manifest.
Manifest(InputStream is)
          Constructs a new Manifest from the specified input stream.
Manifest(Manifest man)
          Constructs a new Manifest that is a copy of the specified Manifest.
 
Method Summary
 void clear()
          Clears the main Attributes as well as the entries in this Manifest.
 Object clone()
          Returns a shallow copy of this Manifest, implemented as follows:
 boolean equals(Object o)
          Returns true if the specified Object is also a Manifest and has the same main Attributes and entries.
 Attributes getAttributes(String name)
          Returns the Attributes for the specified entry name.
 Map getEntries()
          Returns a Map of the entries contained in this Manifest.
 Attributes getMainAttributes()
          Returns the main Attributes for the Manifest.
 int hashCode()
          Returns the hash code for this Manifest.
 void read(InputStream is)
          Reads the Manifest from the specified InputStream.
 void write(OutputStream out)
          Writes the Manifest 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, empty Manifest.

Manifest

public Manifest(InputStream is)
         throws IOException
Constructs a new Manifest from the specified input stream.
Parameters:
is - the input stream containing manifest data

Manifest

public Manifest(Manifest man)
Constructs a new Manifest that is a copy of the specified Manifest.
Parameters:
man - the Manifest to copy
Method Detail

getMainAttributes

public Attributes getMainAttributes()
Returns the main Attributes for the Manifest.

getEntries

public Map getEntries()
Returns a Map of the entries contained in this Manifest. Each entry is represented by a String name (key) and associated Attributes (value).

getAttributes

public Attributes getAttributes(String name)
Returns the Attributes for the specified entry name. This method is defined as:
	    return (Attributes)getEntries().get(name)
 

clear

public void clear()
Clears the main Attributes as well as the entries in this Manifest.

write

public void write(OutputStream out)
           throws IOException
Writes the Manifest to the specified OutputStream.
Parameters:
out - the output stream
Throws:
IOException - if an I/O error has occurred

read

public void read(InputStream is)
          throws IOException
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 - if an I/O error has occurred

equals

public boolean equals(Object o)
Returns true if the specified Object is also a Manifest and has the same main Attributes and entries.
Overrides:
equals in class Object
Parameters:
o - the object to be compared

hashCode

public int hashCode()
Returns the hash code for this Manifest.
Overrides:
hashCode in class Object
Tags copied from class: Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

clone

public Object clone()
Returns a shallow copy of this Manifest, implemented as follows:
     public Object clone() { return new Manifest(this); }
 
Overrides:
clone in class Object
Tags copied from class: Object
Returns:
a clone of this instance.
Throws:
CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
OutOfMemoryError - if there is not enough memory.
See Also:
Cloneable

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.