| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 | |
---|---|
Manifest() 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 Summary | |
---|---|
void |
clear() Clears the main Attributes as well as the entries in this Manifest. |
Object |
clone() 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 |
getAttributes(String name) 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 |
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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Manifest()
public Manifest(InputStream is) throws IOException
is
- the input stream containing manifest dataIOException
- if an I/O error has occuredpublic Manifest(Manifest man)
man
- the Manifest to copyMethod Detail |
---|
public void clear()
public Object clone()
public Object clone() { return new Manifest(this); }
clone
in class Object
public boolean equals(Object o)
equals
in class Object
o
- the object to be comparedpublic Attributes getAttributes(String name)
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}.
name
- entry namepublic Map getEntries()
public Attributes getMainAttributes()
public int hashCode()
hashCode
in class Object
public void read(InputStream is) throws IOException
is
- the input streamIOException
- if an I/O error has occurredpublic void write(OutputStream out) throws IOException
out
- the output streamIOException
- if an I/O error has occurred
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |