All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class ORG.opengroup.jar.ManifestSection

java.lang.Object
    |
    +----ORG.opengroup.jar.ManifestSection

public class ManifestSection
extends Object
implements Serializable, Cloneable
Represents one section of a manifest from a jar file.


Constructor Index

 o ManifestSection()
Null constructor required for serialization.
 o ManifestSection(String)
Normal constructor initializes the section name.
 o ManifestSection(String[])
Load a pre-existing manifest section.

Method Index

 o add(String, String)
Add an item to the section.
 o addHash(byte[])
Add MD5 and SHA security hashes to the section.
 o base64Hash(String, byte[])
Returns a security hash as a base64 ASCII string.
 o clone()
Clones the section.
 o equals(Object)
Returns true if the section names are equal.
 o get()
Returns the contents of the section as an array of strings.
 o get(String)
Returns the value of an item in the section, or null.
 o getFull()
Returns the contents of the section as an array of strings.
 o remove(String)
Remove an item from the section.
 o validate(byte[])
Validate the security hash.

Constructors

 o ManifestSection
public ManifestSection()
Null constructor required for serialization.

 o ManifestSection
public ManifestSection(String id)
Normal constructor initializes the section name.

Parameters:
id - Path name.
 o ManifestSection
public ManifestSection(String[] header)
Load a pre-existing manifest section. Assumption: Continuation lines have the same line delimiter.

Parameters:
header - An array of strings in the form "name: value", or " value".

Methods

 o clone
public Object clone()
Clones the section.

Overrides:
clone in class Object
 o equals
public boolean equals(Object o)
Returns true if the section names are equal.

Parameters:
o - Another ManifestSection.
Overrides:
equals in class Object
 o remove
public void remove(String name)
Remove an item from the section.

Parameters:
name - Name of the item.
 o add
public void add(String name,
                String value)
Add an item to the section.

Parameters:
name - Name of the item.
value - Value assigned to the item.
 o get
public String get(String name)
Returns the value of an item in the section, or null.

Parameters:
name - Name of the item.
Returns:
The assigned value.
 o get
public String[] get()
Returns the contents of the section as an array of strings.

 o getFull
public String[] getFull()
Returns the contents of the section as an array of strings. (Line delimiters are included.)

 o base64Hash
public static String base64Hash(String algorithm,
                                byte[] data) throws NoSuchAlgorithmException
Returns a security hash as a base64 ASCII string.

Parameters:
algorithm - Security hash algorithm name.
data - The data to be hashed.
Throws: NoSuchAlgorithmException
Unimplimented security hash.
 o addHash
public void addHash(byte[] data)
Add MD5 and SHA security hashes to the section.

Parameters:
data - The data associated with the section.
 o validate
public boolean validate(byte[] data) throws NoSuchAlgorithmException
Validate the security hash.

Parameters:
data - The data associated with the section.
Returns:
True when valid.
Throws: NoSuchAlgorithmException
Unimplimented security hash.

All Packages  Class Hierarchy  This Package  Previous  Next  Index