Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Manifest

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, .PrintWriter, .Reader, .StringWriter, java.nio.charset.Charset, .StandardCharsets, java.util.Collections, .Enumeration, .LinkedHashMap, .List, .Locale, .Map, .Objects, .Vector, org.apache.tools.ant.BuildException, org.apache.tools.ant.util.StreamUtils

Holds the data of a jar manifest. 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 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.
Since
Ant 1.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Manifest.Attribute

An attribute for the manifest.

public static class
Manifest.Section

A manifest section - you can nest attribute elements into sections.

Field Summary

Modifier and TypeField and Description
public static final String
ATTRIBUTE_CLASSPATH

The Class-Path Header is special - it can be duplicated

private static final String
public static final String
ATTRIBUTE_FROM

The From Header is disallowed in a Manifest

private static final String
public static final String
ATTRIBUTE_MANIFEST_VERSION

The standard manifest version header

private static final String
public static final String
ATTRIBUTE_NAME

The Name Attribute is the first in a named section

private static final String
public static final String
ATTRIBUTE_SIGNATURE_VERSION

The standard Signature Version header

public static final String
DEFAULT_MANIFEST_VERSION

Default Manifest version if one is not specified

public static final String
EOL

The End-Of-Line marker in manifests

public static final String
ERROR_FROM_FORBIDDEN

Error for attributes

public static final Charset
JAR_CHARSET

Charset to be used for JAR files.

public static final String
JAR_ENCODING

Encoding to be used for JAR files.

private Manifest.Section
mainSection

The main section of this manifest

private String
manifestVersion

The version of this manifest

public static final int
MAX_LINE_LENGTH

The max length of a line in a Manifest

public static final int
MAX_SECTION_LENGTH

Max length of a line section which is continued.

private Map<String, Manifest.Section>
sections

The named sections of this manifest

Constructor Summary

AccessConstructor and Description
public
Manifest()

Construct an empty manifest

public
Manifest(Reader
is the reader from which the Manifest is read
r
)

Read a manifest file from the given reader

Method Summary

Modifier and TypeMethod and Description
public void
addConfiguredAttribute(Manifest.Attribute
the attribute to be added.
attribute
)

Add an attribute to the manifest - it is added to the main section.

public void
addConfiguredSection(Manifest.Section
the manifest section to be added
section
)

Add a section to the manifest

public boolean

Returns:

true if the version, main and sections are the same.
equals
(Object
the object to check for equality.
rhs
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static Manifest

Returns:

the default manifest.
getDefaultManifest
()

Construct a manifest from Ant's default manifest file.

public Manifest.Section

Returns:

the main section of the manifest
getMainSection
()

Get the main section of the manifest

public String

Returns:

the manifest's version string
getManifestVersion
()

Get the version of the manifest

public Manifest.Section

Returns:

the specified section or null if that section does not exist in the manifest
getSection
(String
the name of the section desired.
name
)

Get a particular section from the manifest

public Enumeration<String>

Returns:

an Enumeration of section names
getSectionNames
()

Get the section names in this manifest.

public Enumeration<String>

Returns:

an enumeration of warning strings
getWarnings
()

Get the warnings for this manifest.

public int

Returns:

a hashcode based on the version, main and sections.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public void
merge(Manifest
the Manifest to be merged with this one.
other
)

Merge the contents of the given manifest into this manifest without merging Class-Path attributes.

public void
merge(Manifest
the Manifest to be merged with this one.
other
,
boolean
whether to overwrite the main section of the current manifest
overwriteMain
)

Merge the contents of the given manifest into this manifest without merging Class-Path attributes.

public void
merge(Manifest
the Manifest to be merged with this one.
other
,
boolean
whether to overwrite the main section of the current manifest
overwriteMain
,
boolean
whether Class-Path attributes should be merged.
mergeClassPaths
)

Merge the contents of the given manifest into this manifest

public String

Returns:

a multiline string with the Manifest as it appears in a Manifest file.
toString
()

Overrides java.lang.Object.toString.

Convert the manifest to its string representation
public void
write(PrintWriter
the Writer to which the manifest is written
writer
)

Write the manifest out to a print writer without flattening multi-values attributes (i.e. Class-Path).

public void
write(PrintWriter
the Writer to which the manifest is written
writer
,
boolean
whether to collapse multi-valued attributes (i.e. potentially Class-Path) Class-Path into a single attribute.
flatten
)

Write the manifest out to a print writer.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait