Package org.apache.tools.ant.taskdefs
Class Manifest.Section
java.lang.Object
org.apache.tools.ant.taskdefs.Manifest.Section
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAttributeAndCheck
(Manifest.Attribute attribute) Add an attribute to the sectionvoid
addConfiguredAttribute
(Manifest.Attribute attribute) Add an attribute to the section.clone()
Clone this sectionboolean
getAttribute
(String attributeName) Get a attribute of the sectionGet the attribute keys.getAttributeValue
(String attributeName) Get the value of the attribute with the name given.getName()
Get the Section's name.Get the warnings for this section.int
hashCode()
void
merge
(Manifest.Section section) Merge in another section without merging Class-Path attributes.void
merge
(Manifest.Section section, boolean mergeClassPaths) Merge in another sectionread
(BufferedReader reader) Read a section through a reader.void
removeAttribute
(String attributeName) Remove the given attribute from the sectionvoid
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.
-
Constructor Details
-
Section
public Section()
-
-
Method Details
-
setName
The name of the section; optional -default is the main section.- Parameters:
name
- the section's name
-
getName
-
read
Read a section through a reader.- Parameters:
reader
- the reader from which the section is read- Returns:
- the name of the next section if it has been read as part of this section - This only happens if the Manifest is malformed.
- Throws:
ManifestException
- if the section is not valid according to the JAR specIOException
- if the section cannot be read from the reader.
-
merge
Merge in another section without merging Class-Path attributes.- Parameters:
section
- the section to be merged with this one.- Throws:
ManifestException
- if the sections cannot be merged.
-
merge
Merge in another section- Parameters:
section
- the section to be merged with this one.mergeClassPaths
- whether Class-Path attributes should be merged.- Throws:
ManifestException
- if the sections cannot be merged.
-
write
Write the section out to a print writer without flattening multi-values attributes (i.e. Class-Path).- Parameters:
writer
- the Writer to which the section is written- Throws:
IOException
- if the section cannot be written
-
write
Write the section out to a print writer.- Parameters:
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.- Throws:
IOException
- if the section cannot be written- Since:
- Ant 1.8.0
-
getAttribute
Get a attribute of the section- Parameters:
attributeName
- the name of the attribute- Returns:
- a Manifest.Attribute instance if the attribute is single-valued, otherwise a Vector of Manifest.Attribute instances.
-
getAttributeKeys
Get the attribute keys.- Returns:
- an Enumeration of Strings, each string being the lower case key of an attribute of the section.
-
getAttributeValue
-
removeAttribute
Remove the given attribute from the section- Parameters:
attributeName
- the name of the attribute to be removed.
-
addConfiguredAttribute
Add an attribute to the section.- Parameters:
attribute
- the attribute to be added to the section- Throws:
ManifestException
- if the attribute is not valid.
-
addAttributeAndCheck
Add an attribute to the section- Parameters:
attribute
- the attribute to be added.- Returns:
- the value of the attribute if it is a name attribute - null other wise
- Throws:
ManifestException
- if the attribute already exists in this section.
-
clone
-
getWarnings
Get the warnings for this section.- Returns:
- an Enumeration of warning strings.
-
hashCode
-
equals
-