| java.lang.Object org.netbeans.modules.apisupport.project.EditableManifest
EditableManifest | final public class EditableManifest (Code) | | Similar to
java.util.jar.Manifest but preserves all formatting when changes are made.
Methods which take a section name can accept null for the main section.
(This style is in contrast to that used in
java.util.jar.Attributes .
Does not implement esoteric aspects of the manifest spec such as signature recognition
and line wrapping after 72 characters, but does produce output which can be read
by
java.util.jar.Manifest and Ant's <jar> task.
Will not touch the formatting of any line unless you ask to change it, nor
reorder lines, etc., except to correct line endings or insert a final newline.
Newly added sections and attributes are inserted in alphabetical order.
author: Jesse Glick |
EditableManifest | public EditableManifest()(Code) | | Creates an almost empty manifest.
Contains just Manifest-Version: 1.0 .
|
EditableManifest | public EditableManifest(InputStream is) throws IOException(Code) | | Creates a manifest object from an existing manifest file.
Parameters: is - a stream to load content from (in UTF-8 encoding) throws: IOException - if reading the stream failed, or the contents were syntactically malformed |
addSection | public void addSection(String name) throws IllegalArgumentException(Code) | | Adds a new section.
It will be added in alphabetical order relative to other sections, if they
are already alphabetized.
Parameters: name - the new section name throws: IllegalArgumentException - if a section with that name already existed |
getAttribute | public String getAttribute(String name, String section) throws IllegalArgumentException(Code) | | Find the value of an attribute.
Parameters: name - the attribute name (case-insensitive) Parameters: section - the name of the section to look in, or null for the main section the attribute value, or null if not defined throws: IllegalArgumentException - if the named section does not exist |
getSectionNames | public Set<String> getSectionNames()(Code) | | Gets a list of all named sections (not including the main section).
a list of section names |
removeAttribute | public void removeAttribute(String name, String section) throws IllegalArgumentException(Code) | | Removes an attribute.
Parameters: name - the attribute name to delete (case-insensitive) Parameters: section - the name of the section to remove it from, or null for the main section throws: IllegalArgumentException - if the named section or attribute do not exist |
setAttribute | public void setAttribute(String name, String value, String section) throws IllegalArgumentException(Code) | | Changes the value of an attribute, or adds the attribute if it does not yet exist.
If it is being added, it will be added in alphabetical order relative to
other attributes in the same section, if they are already alphabetized.
Parameters: name - the attribute name (case-insensitive if it already exists) Parameters: value - the new attribute value Parameters: section - the name of the section to add it to, or null for the main section throws: IllegalArgumentException - if the named section does not exist |
write | public void write(OutputStream os) throws IOException(Code) | | Stores the manifest to a file.
Parameters: os - a stream to write content to (in UTF-8 encoding, using platform default line endings) throws: IOException - if writing to the stream failed |
|
|