public class Manifest extends Manifest implements Iterable<String>
Manifests are processed according to the Jar file specification. Specifically, a manifest element consists of a set of attributes and sections. These sections in turn may contain attributes. Note in particular that this may result in manifest lines greater than 72 bytes (including line break) being wrapped and continued on the next line. If an application can not handle the continuation mechanism, it is a defect in the application, not this task.
Modifier and Type | Class and Description |
---|---|
static class |
Manifest.Attribute
An attribute for the manifest.
|
static class |
Manifest.BaseAttribute |
class |
Manifest.ExistingAttribute |
class |
Manifest.ExistingSection |
static class |
Manifest.Section
A manifest section - you can nest attribute elements into sections.
|
Constructor and Description |
---|
Manifest()
Construct an empty manifest
|
Manifest(InputStream is) |
Manifest(Reader r)
Deprecated.
This constructor does not properly map characters to bytes. Use
Manifest(InputStream) . Will be removed in 4.0. |
Modifier and Type | Method and Description |
---|---|
void |
addConfiguredAttribute(Manifest.Attribute attribute)
Add an attribute to the manifest - it is added to the main section.
|
void |
addConfiguredSection(Manifest.Section section)
Add a section to the manifest
|
static Manifest |
getDefaultManifest() |
static Manifest |
getDefaultManifest(boolean minimalDefaultManifest)
Construct a manifest from Ant's default manifest file.
|
Manifest.ExistingSection |
getMainSection()
Get the main section of the manifest
|
String |
getManifestVersion()
Get the version of the manifest
|
Manifest.ExistingSection |
getSection(String name)
Get a particular section from the manifest
|
Iterator<String> |
iterator() |
static String |
remap(Attributes backingAttributes,
Manifest.Attribute attribute) |
String |
toString()
Convert the manifest to its string representation
|
void |
write(Writer writer)
Writes the manifest out to a writer.
|
clear, clone, equals, getAttributes, getEntries, getMainAttributes, hashCode, read, write
public Manifest()
@Deprecated public Manifest(Reader r) throws ManifestException, IOException
Manifest(InputStream)
. Will be removed in 4.0.r
- is the reader from which the Manifest is readManifestException
- if the manifest is not valid according
to the JAR specIOException
- if the manifest cannot be read from the reader.public Manifest(InputStream is) throws IOException
IOException
public static Manifest getDefaultManifest(boolean minimalDefaultManifest) throws ArchiverException
minimalDefaultManifest
- indicates whether a minimal manifest will be created, thus having only
Manifest-Version: 1.0
in it.ArchiverException
- if there is a problem loading the default manifestpublic static Manifest getDefaultManifest() throws ArchiverException
ArchiverException
getDefaultManifest(boolean)
public void addConfiguredSection(Manifest.Section section) throws ManifestException
section
- the manifest section to be addedManifestException
- if the secti0on is not valid.public void addConfiguredAttribute(Manifest.Attribute attribute) throws ManifestException
attribute
- the attribute to be added.ManifestException
- if the attribute is not valid.public void write(Writer writer) throws IOException
writer
- the Writer to which the manifest is writtenIOException
- if the manifest cannot be writtenpublic String toString()
public String getManifestVersion()
public Manifest.ExistingSection getMainSection()
public Manifest.ExistingSection getSection(String name)
name
- the name of the section desired.public static String remap(Attributes backingAttributes, Manifest.Attribute attribute) throws ManifestException
ManifestException
Copyright © 2001–2020 Codehaus Plexus. All rights reserved.