org.apache.tools.ant.taskdefs

Class Manifest.Attribute

public static class Manifest.Attribute extends Object

An attribute for the manifest. Those attributes that are not nested into a section will be added to the "Main" section.
Constructor Summary
Attribute()
Construct an empty attribute
Attribute(String line)
Construct an attribute by parsing a line from the Manifest
Attribute(String name, String value)
Construct a manifest by specifying its name and value
Method Summary
voidaddContinuation(String line)
Add a continuation line from the Manifest file.
voidaddValue(String value)
Add a new value to this attribute - making it multivalued.
booleanequals(Object rhs)
StringgetKey()
Get the attribute's Key - its name in lower case.
StringgetName()
Get the Attribute's name
StringgetValue()
Get the Attribute's value.
EnumerationgetValues()
Get all the attribute's values.
inthashCode()
voidparse(String line)
Parse a line into name and value pairs
voidsetName(String name)
Set the Attribute's name; required
voidsetValue(String value)
Set the Attribute's value; required
voidwrite(PrintWriter writer)
Write the attribute out to a print writer.

Constructor Detail

Attribute

public Attribute()
Construct an empty attribute

Attribute

public Attribute(String line)
Construct an attribute by parsing a line from the Manifest

Parameters: line the line containing the attribute name and value

Throws: ManifestException if the line is not valid

Attribute

public Attribute(String name, String value)
Construct a manifest by specifying its name and value

Parameters: name the attribute's name value the Attribute's value

Method Detail

addContinuation

public void addContinuation(String line)
Add a continuation line from the Manifest file. When lines are too long in a manifest, they are continued on the next line by starting with a space. This method adds the continuation data to the attribute value by skipping the first character.

Parameters: line the continuation line.

addValue

public void addValue(String value)
Add a new value to this attribute - making it multivalued.

Parameters: value the attribute's additional value

equals

public boolean equals(Object rhs)

See Also: java.lang.Object#equals

getKey

public String getKey()
Get the attribute's Key - its name in lower case.

Returns: the attribute's key.

getName

public String getName()
Get the Attribute's name

Returns: the attribute's name.

getValue

public String getValue()
Get the Attribute's value.

Returns: the attribute's value.

getValues

public Enumeration getValues()
Get all the attribute's values.

Returns: an enumeration of the attributes values

hashCode

public int hashCode()

See Also: java.lang.Object#hashCode

parse

public void parse(String line)
Parse a line into name and value pairs

Parameters: line the line to be parsed

Throws: ManifestException if the line does not contain a colon separating the name and value

setName

public void setName(String name)
Set the Attribute's name; required

Parameters: name the attribute's name

setValue

public void setValue(String value)
Set the Attribute's value; required

Parameters: value the attribute's value

write

public void write(PrintWriter writer)
Write the attribute out to a print writer.

Parameters: writer the Writer to which the attribute is written

Throws: IOException if the attribute value cannot be written

Copyright