Constructor and Description |
---|
Section() |
Modifier and Type | Method and Description |
---|---|
String |
addAttributeAndCheck(Manifest.Attribute attribute)
Add an attribute to the section
|
void |
addConfiguredAttribute(Manifest.Attribute attribute)
Add an attribute to the section.
|
Object |
clone()
Clone this section
|
boolean |
equals(Object rhs)
Indicates whether some other object is "equal to" this one.
|
Manifest.Attribute |
getAttribute(String attributeName)
Get a attribute of the section
|
Enumeration<String> |
getAttributeKeys()
Get the attribute keys.
|
String |
getAttributeValue(String attributeName)
Get the value of the attribute with the name given.
|
String |
getName()
Get the Section's name.
|
Enumeration<String> |
getWarnings()
Get the warnings for this section.
|
int |
hashCode()
Returns a hash code value for the object.
|
void |
merge(Manifest.Section section)
Merge in another section without merging Class-Path attributes.
|
void |
merge(Manifest.Section section,
boolean mergeClassPaths)
Merge in another section
|
String |
read(BufferedReader reader)
Read a section through a reader.
|
void |
removeAttribute(String attributeName)
Remove the given attribute from the section
|
void |
setName(String name)
The name of the section; optional -default is the main section.
|
void |
write(PrintWriter writer)
Write the section out to a print writer without flattening
multi-values attributes (i.e.
|
void |
write(PrintWriter writer,
boolean flatten)
Write the section out to a print writer.
|
public String addAttributeAndCheck(Manifest.Attribute attribute) throws ManifestException
attribute
- the attribute to be added.ManifestException
- if the attribute already
exists in this section.public void addConfiguredAttribute(Manifest.Attribute attribute) throws ManifestException
attribute
- the attribute to be added to the sectionManifestException
- if the attribute is not valid.public Object clone()
public boolean equals(Object rhs)
Object
The equals
method implements an equivalence relation on non-null object references:
x
, x.equals(x)
should return true
.
x
and y
,
x.equals(y)
should return true
if and only if y.equals(x)
returns
true
.
x
, y
, and
z
, if x.equals(y)
returns true
and y.equals(z)
returns
true
, then x.equals(z)
should return true
.
x
and y
, multiple
invocations of x.equals(y)
consistently return true
or consistently return
false
, provided no information used in equals
comparisons on the objects is
modified.
x
, x.equals(null)
should return
false
.
The equals
method for class Object
implements the most discriminating possible
equivalence relation on objects; that is, for any non-null reference values x
and
y
, this method returns true
if and only if x
and y
refer to the
same object (x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method
is overridden, so as to maintain the general contract for the hashCode
method, which
states that equal objects must have equal hash codes.
equals
in class Object
rhs
- the object to check for equality.Object.equals(java.lang.Object)
public Manifest.Attribute getAttribute(String attributeName)
attributeName
- the name of the attributepublic Enumeration<String> getAttributeKeys()
public String getAttributeValue(String attributeName)
attributeName
- the name of the attribute to be returned.public String getName()
public Enumeration<String> getWarnings()
public int hashCode()
Object
HashMap
.
The general contract of hashCode
is:
hashCode
method must consistently return the same integer, provided no
information used in equals
comparisons on the object is modified. This integer need not
remain consistent from one execution of an application to another execution of the same
application.
equals(Object)
method, then calling the
hashCode
method on each of the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode
method on each of the two objects must produce distinct integer results. However, the programmer
should be aware that producing distinct integer results for unequal objects may improve the
performance of hash tables.
As much as is reasonably practical, the hashCode method defined by class Object
does
return distinct integers for distinct objects. (This is typically implemented by converting the
internal address of the object into an integer, but this implementation technique is not required
by the JavaTM programming language.)
hashCode
in class Object
Object.hashCode()
public void merge(Manifest.Section section) throws ManifestException
section
- the section to be merged with this one.ManifestException
- if the sections cannot be merged.public void merge(Manifest.Section section, boolean mergeClassPaths) throws ManifestException
section
- the section to be merged with this one.mergeClassPaths
- whether Class-Path attributes should
be merged.ManifestException
- if the sections cannot be merged.public String read(BufferedReader reader) throws ManifestException, IOException
reader
- the reader from which the section is readManifestException
- if the section is not valid according
to the JAR specIOException
- if the section cannot be read from the reader.public void removeAttribute(String attributeName)
attributeName
- the name of the attribute to be removed.public void setName(String name)
name
- the section's namepublic void write(PrintWriter writer) throws IOException
writer
- the Writer to which the section is writtenIOException
- if the section cannot be writtenpublic void write(PrintWriter writer, boolean flatten) throws IOException
writer
- the Writer to which the section is writtenflatten
- whether to collapse multi-valued attributes
(i.e. potentially Class-Path) Class-Path into a
single attribute.IOException
- if the section cannot be written