org.codehaus.plexus.archiver.jar
Class Manifest.Attribute
java.lang.Object
org.codehaus.plexus.archiver.jar.Manifest.Attribute
- Manifest
public static class Manifest.Attribute
extends java.lang.Object
An attribute for the manifest.
Those attributes that are not nested into a section will be added to the "Main" section.
private int | currentIndex - For multivalued attributes, this is the index of the attribute
currently being defined.
|
private String | name - The attribute's name
|
private Vector | values - The attribute's value
|
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
|
void | addContinuation(String line) - Add a continuation line from the Manifest file.
|
void | addValue(String value) - Add a new value to this attribute - making it multivalued.
|
boolean | equals(Object rhs)
|
String | getKey() - Get the attribute's Key - its name in lower case.
|
String | getName() - Get the Attribute's name
|
String | getValue() - Get the Attribute's value.
|
Enumeration | getValues() - Get all the attribute's values.
|
int | hashCode()
|
void | parse(String line) - Parse a line into name and value pairs
|
void | setName(String name) - Set the Attribute's name; required
|
void | setValue(String value) - Set the Attribute's value; required
|
void | write(PrintWriter writer) - Write the attribute out to a print writer.
|
private void | writeLine(PrintWriter writer, String line) - Write a single Manifest line.
|
private void | writeValue(PrintWriter writer, String value) - Write a single attribute value out.
|
currentIndex
private int currentIndex
For multivalued attributes, this is the index of the attribute
currently being defined.
name
private String name
The attribute's name
values
private Vector values
The attribute's value
Attribute
public Attribute()
Construct an empty attribute
Attribute
public Attribute(String line)
throws ManifestException
Construct an attribute by parsing a line from the Manifest
line
- the line containing the attribute name and value
Attribute
public Attribute(String name,
String value)
Construct a manifest by specifying its name and value
name
- the attribute's namevalue
- the Attribute's value
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.
line
- the continuation line.
addValue
public void addValue(String value)
Add a new value to this attribute - making it multivalued.
value
- the attribute's additional value
equals
public boolean equals(Object rhs)
getKey
public String getKey()
Get the attribute's Key - its name in lower case.
getName
public String getName()
Get the Attribute's name
getValue
public String getValue()
Get the Attribute's value.
getValues
public Enumeration getValues()
Get all the attribute's values.
- an enumeration of the attributes values
hashCode
public int hashCode()
java.lang.Object.hashCode
parse
public void parse(String line)
throws ManifestException
Parse a line into name and value pairs
line
- the line to be parsed
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
name
- the attribute's name
setValue
public void setValue(String value)
Set the Attribute's value; required
value
- the attribute's value
write
public void write(PrintWriter writer)
throws IOException
Write the attribute out to a print writer.
writer
- the Writer to which the attribute is written
writeLine
private void writeLine(PrintWriter writer,
String line)
throws IOException
Write a single Manifest line. Should handle more than 72 characters of line
writer
- the Writer to which the attribute is writtenline
- the manifest line to be written
writeValue
private void writeValue(PrintWriter writer,
String value)
throws IOException
Write a single attribute value out. Should handle multiple lines of attribute value.
writer
- the Writer to which the attribute is writtenvalue
- the attribute value