This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.util.jar
class Manifest

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

Most common ways to construct:

JarFile jarfile = …;

Manifest manifest = jarfile.getManifest();

Based on 29 examples

 

Manifest manifest = new Manifest();

Based on 25 examples


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. For information on the Manifest format, please see the Manifest format specification.


Constructor Summary

          Constructs a new, empty Manifest.

          Constructs a new Manifest from the specified input stream.

          Constructs a new Manifest that is a copy of the specified Manifest.
 
Method Summary
 void

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

          Returns a shallow copy of this Manifest.
 boolean

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

          Returns the Attributes for the specified entry name.
 Map

          Returns a Map of the entries contained in this Manifest.
 Attributes

          Returns the main Attributes for the Manifest.
 int

          Returns the hash code for this Manifest.
 void

          Reads the Manifest from the specified InputStream.
 void

          Writes the Manifest to the specified OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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
Throws:
IOException - if an I/O error has occured

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

clear

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


clone

public Object clone()
Returns a shallow copy of this Manifest. The shallow copy is implemented as follows:
     public Object clone() { return new Manifest(this); }
 

Overrides:
clone in class Object
Returns:
a shallow copy of this Manifest

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
Returns:
true if the specified Object is also a Manifest and has the same main Attributes and entries

getAttributes

public Attributes getAttributes(String name)
Returns the Attributes for the specified entry name. This method is defined as:
	    return (Attributes)getEntries().get(name)
 
Though {@code null} is a valid {@code name}, when {@code getAttributes(null)} is invoked on a {@code Manifest} obtained from a jar file, {@code null} will be returned. While jar files themselves do not allow {@code null}-named attributes, it is possible to invoke {@link #getEntries} on a {@code Manifest}, and on that result, invoke {@code put} with a null key and an arbitrary value. Subsequent invocations of {@code getAttributes(null)} will return the just-{@code put} value.

Note that this method does not return the manifest's main attributes; see {@link #getMainAttributes}.

Parameters:
name - entry name
Returns:
the Attributes for the specified entry name

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). The Map permits the {@code null} key, but no entry with a null key is created by {@link #read}, nor is such an entry written by using {@link #write}.

Returns:
a Map of the entries contained in this Manifest

getMainAttributes

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

Returns:
the main Attributes for the Manifest

hashCode

public int hashCode()
Returns the hash code for this Manifest.

Overrides:
hashCode in class Object

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

write

public void write(OutputStream out)
           throws IOException
Writes 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


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.