| Modifier and Type | Class and Description |
|---|---|
| public static class | Jar.FilesetManifestConfig
The manifest config enumerated type. |
| private static class | Jar.IndexJarsFilenameMapper
A mapper for the index based on the classpath attribute in the manifest. |
| public static class | Jar.StrictMode
The strict enumerated type. |
| Modifier and Type | Field and Description |
|---|---|
| private Manifest | configuredManifest
merged manifests added through addConfiguredManifest |
| private boolean | createEmpty
whether to really create the archive in createEmptyZip, will get set in getResourcesToAdd. |
| private Manifest | filesetManifest
merged manifests added through filesets |
| private Jar. | filesetManifestConfig
whether to merge fileset manifests; value is true if filesetmanifest is 'merge' or 'mergewithoutmain' |
| private boolean | flattenClassPaths
whether to flatten Class-Path attributes into a single one. |
| private boolean | index
jar index is JDK 1.3+ only |
| private static final String | INDEX_NAME
The index file name. |
| private Path | indexJars
Path containing jars that shall be indexed in addition to this archive. |
| private FileNameMapper | indexJarsMapper
A mapper used to convert the jars to entries in the index. |
| private boolean | indexMetaInf
Whether to index META-INF/ and its children |
| private static final ZipExtraField[] | JAR_MARKER
Extra fields needed to make Solaris recognize the archive as a jar file. |
| private Manifest | manifest
the manifest specified by the 'manifest' attribute |
| private static final String | MANIFEST_NAME
The manifest file name. |
| private String | manifestEncoding
The encoding to use when reading in a manifest file |
| private File | manifestFile
The file found from the 'manifest' attribute. |
| private boolean | mergeClassPaths
whether to merge Class-Path attributes. |
| private boolean | mergeManifestsMain
whether to merge the main section of fileset manifests; value is true if filesetmanifest is 'merge' |
| private Manifest | originalManifest
Manifest of original archive, will be set to null if not in update mode. |
| private List | rootEntries
Stores all files that are in the root of the archive (i.e. that have a name that doesn't contain a slash) so they can get listed in the index. |
| private Manifest | savedConfiguredManifest
shadow of the above if upToDate check alters the value |
| private List | serviceList
List of all known SPI Services |
| private Jar. | strict
Strict mode for checking rules of the JAR-Specification. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | addConfiguredIndexJarsMapper(Mapper
a mapper mapper)Add a mapper used to convert the jars to entries in the index. |
| public void | addConfiguredManifest(Manifest
an embedded manifest element newManifest)Allows the manifest for the archive file to be provided inline in the build file rather than in an external file. |
| public void | |
| public void | |
| private void | |
| protected void | cleanUp()
Overrides org. |
| private FileNameMapper | Returns: a mapperCreates a mapper for the index based on the classpath attribute in the manifest. |
| protected boolean | Returns: true for historic reasonsthe file to create zipFile)
Create an empty jar file.
|
| private void | createIndexList(ZipOutputStream
the zip stream representing the jar being built. zOut)Create the index list to speed up classloading. |
| private Manifest | |
| private void | |
| protected void | finalizeZipOutputStream(ZipOutputStream
the zip output stream zOut)Overrides org. |
| protected static String | Returns: the matching entry, or null if the file is not foundthe name to look for fileName, String[] the classpath to look in (may be null) classpath)try to guess the name of the given file. |
| public FileNameMapper | |
| private Manifest | |
| private Manifest | |
| private Charset | |
| private Manifest | Returns: null if jarFile doesn't contain a manifest, the manifest otherwise.
|
| protected Zip. | Returns: an array of resources to add for each fileset passed in as well as a flag that indicates whether the archive is uptodate.The resource collections to grab resources from rcs, File intended archive file (may or may not exist) zipFile, boolean whether we already know that the archive is
out-of-date. Subclasses overriding this method are supposed to
set this value correctly in their call to
super.getResourcesToAdd. needsUpdate)Overrides org. |
| protected static void | |
| private Resource[][] | |
| protected void | initZipOutputStream(ZipOutputStream
the zip output stream zOut)Overrides org. |
| private boolean | |
| public void | |
| public void | setFilesetmanifest(Jar.
setting for found manifest behavior. configBehavior when a Manifest is found in a zipfileset or zipgroupfileset file. |
| public void | setFlattenAttributes(boolean
boolean b)Whether to flatten multi-valued attributes (i.e. Class-Path) into a single one. |
| public void | |
| public void | setIndexMetaInf(boolean
a flag)boolean value, defaults to falseSet whether or not to add META-INF and its children to the index. |
| public void | setJarfile(File
the destination file jarFile)
Deprecated
since 1.5.x.
Use setDestFile(File) instead.
Set the destination file.
|
| public void | |
| public void | setManifestEncoding(String
the character encoding manifestEncoding)The character encoding to use in the manifest file. |
| public void | |
| public void | |
| public void | setWhenempty(Zip.
not used we |
| public void | setWhenmanifestonly(Zip.
a weWhenEmpty enumerated valueIndicates if a jar file should be created when it would only contain a manifest file. |
| protected final void | writeIndexLikeList(List<String>
a list of directories dirs, List<String> a list of files files, PrintWriter the writer to write to writer)Writes the directory entries from the first and the filenames from the second list to the given writer, one entry per line. |
| private void | |
| private void | |
| protected void | zipFile(InputStream
the stream to read data for the entry from. The
caller of the method is responsible for closing the stream. is, ZipOutputStream the zip output stream zOut, String the name this entry shall have in the archive vPath, long last modification time for the entry. lastModified, File the original archive we are copying this
entry from, will be null if we are not copying from an archive. fromArchive, int the Unix permissions to set. mode)Overrides org. |
| configuredManifest | back to summary |
|---|---|
| private Manifest configuredManifest merged manifests added through addConfiguredManifest | |
| createEmpty | back to summary |
|---|---|
| private boolean createEmpty whether to really create the archive in createEmptyZip, will get set in getResourcesToAdd. | |
| filesetManifest | back to summary |
|---|---|
| private Manifest filesetManifest merged manifests added through filesets | |
| filesetManifestConfig | back to summary |
|---|---|
| private Jar. whether to merge fileset manifests; value is true if filesetmanifest is 'merge' or 'mergewithoutmain' | |
| flattenClassPaths | back to summary |
|---|---|
| private boolean flattenClassPaths whether to flatten Class-Path attributes into a single one. | |
| index | back to summary |
|---|---|
| private boolean index jar index is JDK 1.3+ only | |
| INDEX_NAME | back to summary |
|---|---|
| private static final String INDEX_NAME The index file name. | |
| indexJars | back to summary |
|---|---|
| private Path indexJars Path containing jars that shall be indexed in addition to this archive.
| |
| indexJarsMapper | back to summary |
|---|---|
| private FileNameMapper indexJarsMapper A mapper used to convert the jars to entries in the index.
| |
| indexMetaInf | back to summary |
|---|---|
| private boolean indexMetaInf Whether to index META-INF/ and its children | |
| JAR_MARKER | back to summary |
|---|---|
| private static final ZipExtraField[] JAR_MARKER Extra fields needed to make Solaris recognize the archive as a jar file.
| |
| manifest | back to summary |
|---|---|
| private Manifest manifest the manifest specified by the 'manifest' attribute | |
| MANIFEST_NAME | back to summary |
|---|---|
| private static final String MANIFEST_NAME The manifest file name. | |
| manifestEncoding | back to summary |
|---|---|
| private String manifestEncoding The encoding to use when reading in a manifest file | |
| manifestFile | back to summary |
|---|---|
| private File manifestFile The file found from the 'manifest' attribute. This can be either the location of a manifest, or the name of a jar added through a fileset. If its the name of an added jar, the manifest is looked for in META-INF/MANIFEST.MF | |
| mergeClassPaths | back to summary |
|---|---|
| private boolean mergeClassPaths whether to merge Class-Path attributes. | |
| mergeManifestsMain | back to summary |
|---|---|
| private boolean mergeManifestsMain whether to merge the main section of fileset manifests; value is true if filesetmanifest is 'merge' | |
| originalManifest | back to summary |
|---|---|
| private Manifest originalManifest Manifest of original archive, will be set to null if not in update mode. | |
| rootEntries | back to summary |
|---|---|
| private List<String> rootEntries Stores all files that are in the root of the archive (i.e. that have a name that doesn't contain a slash) so they can get listed in the index. Will not be filled unless the user has asked for an index.
| |
| savedConfiguredManifest | back to summary |
|---|---|
| private Manifest savedConfiguredManifest shadow of the above if upToDate check alters the value | |
| serviceList | back to summary |
|---|---|
| private List<Service> serviceList List of all known SPI Services | |
| strict | back to summary |
|---|---|
| private Jar. Strict mode for checking rules of the JAR-Specification. | |
| Jar | back to summary |
|---|---|
| public Jar() constructor | |
| addConfiguredIndexJars | back to summary |
|---|---|
| public void addConfiguredIndexJars(Path p) Add a path to index jars.
| |
| addConfiguredIndexJarsMapper | back to summary |
|---|---|
| public void addConfiguredIndexJarsMapper(Mapper mapper) Add a mapper used to convert the jars to entries in the index.
| |
| addConfiguredManifest | back to summary |
|---|---|
| public void addConfiguredManifest(Manifest newManifest) throws ManifestException Allows the manifest for the archive file to be provided inline in the build file rather than in an external file.
| |
| addConfiguredService | back to summary |
|---|---|
| public void addConfiguredService(Service service) A nested SPI service element.
| |
| addMetainf | back to summary |
|---|---|
| public void addMetainf(ZipFileSet fs) Adds a zipfileset to include in the META-INF directory.
| |
| checkJarSpec | back to summary |
|---|---|
| private void checkJarSpec() Check against packaging spec | |
| cleanUp | back to summary |
|---|---|
| protected void cleanUp() Overrides org. Make sure we don't think we already have a MANIFEST next time this task gets executed.
| |
| createDefaultIndexJarsMapper | back to summary |
|---|---|
| private FileNameMapper createDefaultIndexJarsMapper() Creates a mapper for the index based on the classpath attribute in the manifest.
See
| |
| createEmptyZip | back to summary |
|---|---|
| protected boolean createEmptyZip(File zipFile) throws BuildException Overrides org. Create an empty jar file.
| |
| createIndexList | back to summary |
|---|---|
| private void createIndexList(ZipOutputStream zOut) throws IOException Create the index list to speed up classloading. This is a JDK 1.3+ specific feature and is enabled by default. See the JAR index specification for more details.
| |
| createManifest | back to summary |
|---|---|
| private Manifest createManifest() throws BuildException | |
| filesetManifest | back to summary |
|---|---|
| private void filesetManifest(File file, InputStream is) throws IOException | |
| finalizeZipOutputStream | back to summary |
|---|---|
| protected void finalizeZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException Overrides org. Finalize the zip output stream. This creates an index list if the index attribute is true.
| |
| findJarName | back to summary |
|---|---|
| protected static String findJarName(String fileName, String[] classpath) try to guess the name of the given file. If this jar has a classpath attribute in its manifest, we can assume that it will only require an index of jars listed there. try to find which classpath entry is most likely the one the given file name points to. In the absence of a classpath attribute, assume the other files will be placed inside the same directory as this jar and use their basename. if there is a classpath and the given file doesn't match any of its entries, return null. | |
| getIndexJarsMapper | back to summary |
|---|---|
| public FileNameMapper getIndexJarsMapper() Returns the mapper used to convert the jars to entries in the index. May be null.
| |
| getManifest | back to summary |
|---|---|
| private Manifest getManifest(File manifestFile) | |
| getManifest | back to summary |
|---|---|
| private Manifest getManifest(Reader r) | |
| getManifestCharset | back to summary |
|---|---|
| private Charset getManifestCharset() | |
| getManifestFromJar | back to summary |
|---|---|
private Manifest getManifestFromJar(File jarFile) throws IOException
| |
| getResourcesToAdd | back to summary |
|---|---|
| protected Zip. Overrides org. Collect the resources that are newer than the corresponding entries (or missing) in the original archive. If we are going to recreate the archive instead of updating
it, all resources should be considered as new, if a single one
is. Because of this, subclasses overriding this method must
call
| |
| grabFilesAndDirs | back to summary |
|---|---|
| protected static void grabFilesAndDirs(String file, List<String> dirs, List<String> files) throws IOException Grab lists of all root-level files and all directories contained in the given archive. | |
| grabManifests | back to summary |
|---|---|
| private Resource[][] grabManifests(ResourceCollection[] rcs) | |
| initZipOutputStream | back to summary |
|---|---|
| protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException Overrides org. Initialize the zip output stream.
| |
| jarHasIndex | back to summary |
|---|---|
| private boolean jarHasIndex(File jarFile) throws IOException | |
| reset | back to summary |
|---|---|
| public void reset() Overrides org. reset to default values. | |
| setFilesetmanifest | back to summary |
|---|---|
| public void setFilesetmanifest(Jar. Behavior when a Manifest is found in a zipfileset or zipgroupfileset file. Valid values are "skip", "merge", and "mergewithoutmain". "merge" will merge all of manifests together, and merge this into any other specified manifests. "mergewithoutmain" merges everything but the Main section of the manifests. Default value is "skip". Note if this attribute's value is not "skip", the created jar will not be readable by using java.util.jar.JarInputStream
| |
| setFlattenAttributes | back to summary |
|---|---|
| public void setFlattenAttributes(boolean b) Whether to flatten multi-valued attributes (i.e. Class-Path) into a single one.
| |
| setIndex | back to summary |
|---|---|
| public void setIndex(boolean flag) Set whether or not to create an index list for classes. This may speed up classloading in some cases.
| |
| setIndexMetaInf | back to summary |
|---|---|
| public void setIndexMetaInf(boolean flag) Set whether or not to add META-INF and its children to the index. Doesn't have any effect if index is false. Sun's jar implementation used to skip the META-INF directory and Ant followed that example. The behavior has been changed with Java 5. In order to avoid problems with Ant generated jars on Java 1.4 or earlier Ant will not include META-INF unless explicitly asked to.
| |
| setJarfile | back to summary |
|---|---|
| public void setJarfile(File jarFile)
Deprecated since 1.5.x. Use setDestFile(File) instead. Set the destination file.
| |
| setManifest | back to summary |
|---|---|
| public void setManifest(File manifestFile) The manifest file to use. This can be either the location of a manifest, or the name of a jar added through a fileset. If its the name of an added jar, the task expects the manifest to be in the jar at META-INF/MANIFEST.MF.
| |
| setManifestEncoding | back to summary |
|---|---|
| public void setManifestEncoding(String manifestEncoding) The character encoding to use in the manifest file.
| |
| setMergeClassPathAttributes | back to summary |
|---|---|
| public void setMergeClassPathAttributes(boolean b) Whether to merge Class-Path attributes.
| |
| setStrict | back to summary |
|---|---|
| public void setStrict(Jar. Activate the strict mode. When set to true a BuildException will be thrown if the Jar-Packaging specification was broken.
| |
| setWhenempty | back to summary |
|---|---|
| public void setWhenempty(Zip. Overrides org. Not used for jar files. | |
| setWhenmanifestonly | back to summary |
|---|---|
| public void setWhenmanifestonly(Zip. Indicates if a jar file should be created when it would only contain a
manifest file.
Possible values are: | |
| writeIndexLikeList | back to summary |
|---|---|
| protected final void writeIndexLikeList(List<String> dirs, List<String> files, PrintWriter writer) Writes the directory entries from the first and the filenames from the second list to the given writer, one entry per line.
| |
| writeManifest | back to summary |
|---|---|
| private void writeManifest(ZipOutputStream zOut, Manifest manifest) throws IOException | |
| writeServices | back to summary |
|---|---|
| private void writeServices(ZipOutputStream zOut) throws IOException Write SPI Information to JAR | |
| zipFile | back to summary |
|---|---|
| protected void zipFile(InputStream is, ZipOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode) throws IOException Overrides org. Overridden from Zip class to deal with manifests and index lists.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | Returns: the list of values - "skip", "merge" and "mergewithoutmain"Implements abstract org. |
| FilesetManifestConfig | back to summary |
|---|---|
| public FilesetManifestConfig() | |
| getValues | back to summary |
|---|---|
| public String[] getValues() Implements abstract org. Get the list of valid strings. | |
findJarName(String, String[]) for more details.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | mapFileName(String
the name of the source file relative to
some given basedirectory. Might be sourceFileName)null for resources that don't provide a
name.Implements org. |
| public void | setFrom(String
a string. from)Implements org. |
| public void | setTo(String
a string. to)Implements org. |
| classpath | back to summary |
|---|---|
| private String[] classpath | |
| IndexJarsFilenameMapper | back to summary |
|---|---|
| pack-priv IndexJarsFilenameMapper(String[] classpath) | |
| mapFileName | back to summary |
|---|---|
| public String[] mapFileName(String sourceFileName) Implements org. Doc from org. Returns an array containing the target filename(s) for the given source file. if the given rule doesn't apply to the source file, implementation must return null. SourceFileScanner will then omit the source file in question. | |
| setFrom | back to summary |
|---|---|
| public void setFrom(String from) Implements org. Empty implementation.
| |
| setTo | back to summary |
|---|---|
| public void setTo(String to) Implements org. Empty implementation.
| |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public String[] | Returns: the list of values.Implements abstract org. |
| StrictMode | back to summary |
|---|---|
| public StrictMode() Public no arg constructor. | |
| StrictMode | back to summary |
|---|---|
| public StrictMode(String value) Constructor with an arg.
| |
| getLogLevel | back to summary |
|---|---|
public int getLogLevel()
| |
| getValues | back to summary |
|---|---|
| public String[] getValues() Implements abstract org. Get List of valid strings. | |