Manifest
open class Manifest : Cloneable
kotlin.Any | |
↳ | java.util.jar.Manifest |
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.
Summary
Public constructors | |
---|---|
Manifest() Constructs a new, empty Manifest. |
|
Manifest(is: InputStream!) Constructs a new Manifest from the specified input stream. |
|
Constructs a new Manifest that is a copy of the specified Manifest. |
Public methods | |
---|---|
open Unit |
clear() Clears the main Attributes as well as the entries in this Manifest. |
open Any |
clone() Returns a shallow copy of this Manifest. |
open Boolean |
Returns true if the specified Object is also a Manifest and has the same main Attributes and entries. |
open Attributes! |
getAttributes(name: String!) Returns the Attributes for the specified entry name. |
open MutableMap<String!, Attributes!>! |
Returns a Map of the entries contained in this Manifest. |
open Attributes! |
Returns the main Attributes for the Manifest. |
open Int |
hashCode() Returns the hash code for this Manifest. |
open Unit |
read(is: InputStream!) Reads the Manifest from the specified InputStream. |
open Unit |
write(out: OutputStream!) Writes the Manifest to the specified OutputStream. |
Public constructors
Manifest
Manifest(is: InputStream!)
Constructs a new Manifest from the specified input stream.
Parameters | |
---|---|
is |
InputStream!: the input stream containing manifest data |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error has occurred |
Manifest
Manifest(man: Manifest!)
Constructs a new Manifest that is a copy of the specified Manifest.
Parameters | |
---|---|
man |
Manifest!: the Manifest to copy |
Public methods
clear
open fun clear(): Unit
Clears the main Attributes as well as the entries in this Manifest.
clone
open fun clone(): Any
Returns a shallow copy of this Manifest. The shallow copy is implemented as follows:
public Object clone() { return new Manifest(this); }
Return | |
---|---|
Any |
a shallow copy of this Manifest |
Exceptions | |
---|---|
java.lang.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. |
equals
open fun equals(other: Any?): Boolean
Returns true if the specified Object is also a Manifest and has the same main Attributes and entries.
Parameters | |
---|---|
obj |
the reference object with which to compare. |
o |
the object to be compared |
Return | |
---|---|
Boolean |
true if the specified Object is also a Manifest and has the same main Attributes and entries |
getAttributes
open fun getAttributes(name: String!): Attributes!
Returns the Attributes for the specified entry name. This method is defined as:
return (Attributes)getEntries().get(name)
null
is a valid name
, when getAttributes(null)
is invoked on a Manifest
obtained from a jar file, null
will be returned. While jar files themselves do not allow null
-named attributes, it is possible to invoke getEntries
on a Manifest
, and on that result, invoke put
with a null key and an arbitrary value. Subsequent invocations of getAttributes(null)
will return the just-put
value.
Note that this method does not return the manifest's main attributes; see getMainAttributes
.
Parameters | |
---|---|
name |
String!: entry name |
Return | |
---|---|
Attributes! |
the Attributes for the specified entry name |
getEntries
open fun getEntries(): MutableMap<String!, Attributes!>!
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 null
key, but no entry with a null key is created by read
, nor is such an entry written by using write
.
Return | |
---|---|
MutableMap<String!, Attributes!>! |
a Map of the entries contained in this Manifest |
getMainAttributes
open fun getMainAttributes(): Attributes!
Returns the main Attributes for the Manifest.
Return | |
---|---|
Attributes! |
the main Attributes for the Manifest |
hashCode
open fun hashCode(): Int
Returns the hash code for this Manifest.
Return | |
---|---|
Int |
a hash code value for this object. |
read
open fun read(is: InputStream!): Unit
Reads the Manifest from the specified InputStream. The entry names and attributes read will be merged in with the current manifest entries.
Parameters | |
---|---|
is |
InputStream!: the input stream |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error has occurred |
write
open fun write(out: OutputStream!): Unit
Writes the Manifest to the specified OutputStream. Attributes.Name.MANIFEST_VERSION must be set in MainAttributes prior to invoking this method.
Parameters | |
---|---|
out |
OutputStream!: the output stream |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error has occurred |
See Also