org.codehaus.plexus.archiver.jar
public class JarArchiver extends ZipArchiver
Version: $Revision: 3560 $ $Date: 2006-07-25 01:14:00 -0400 (Tue, 25 Jul 2006) $
Nested Class Summary | |
---|---|
static class | JarArchiver.FilesetManifestConfig |
Field Summary | |
---|---|
Manifest | configuredManifest
merged manifests added through addConfiguredManifest |
boolean | createEmpty
whether to really create the archive in createEmptyZip, will
get set in getResourcesToAdd. |
Manifest | filesetManifest
merged manifests added through filesets |
JarArchiver.FilesetManifestConfig | filesetManifestConfig
whether to merge fileset manifests;
value is true if filesetmanifest is 'merge' or 'mergewithoutmain' |
boolean | index
jar index is JDK 1.3+ only |
ArrayList | indexJars
Path containing jars that shall be indexed in addition to this archive. |
static String | INDEX_NAME
The index file name. |
Manifest | manifest
the manifest specified by the 'manifest' attribute * |
String | manifestEncoding
The encoding to use when reading in a manifest file |
File | manifestFile
The file found from the 'manifest' attribute. |
boolean | mergeManifestsMain
whether to merge the main section of fileset manifests;
value is true if filesetmanifest is 'merge' |
static String | MANIFEST_NAME
The manifest file name. |
Manifest | originalManifest
Manifest of original archive, will be set to null if not in
update mode. |
Vector | 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.
|
Manifest | savedConfiguredManifest
shadow of the above if upToDate check alters the value |
Constructor Summary | |
---|---|
JarArchiver()
constructor |
Method Summary | |
---|---|
void | addConfiguredIndexJars(File indexJar) |
void | addConfiguredManifest(Manifest newManifest)
Allows the manifest for the archive file to be provided inline
in the build file rather than in an external file.
|
protected void | cleanUp()
Make sure we don't think we already have a MANIFEST next time this task
gets executed.
|
protected boolean | createEmptyZip(File zipFile) |
void | createIndexList(ZipOutputStream zOut)
Create the index list to speed up classloading.
|
Manifest | createManifest() |
void | filesetManifest(File file, InputStream is) |
protected void | finalizeZipOutputStream(ZipOutputStream zOut) |
protected static String | findJarName(String fileName, String[] classpath)
try to guess the name of the given file.
|
Manifest | getManifest(File manifestFile) |
Manifest | getManifest(Reader r) |
protected static void | grabFilesAndDirs(String file, List dirs, List files)
Grab lists of all root-level files and all directories
contained in the given archive. |
protected void | initZipOutputStream(ZipOutputStream zOut) |
void | reset()
reset to default values.
|
void | setFilesetmanifest(JarArchiver.FilesetManifestConfig config)
Behavior when a Manifest is found in a zipfileset or zipgroupfileset file.
|
void | setIndex(boolean flag)
Set whether or not to create an index list for classes.
|
void | setManifest(File manifestFile)
The manifest file to use. |
void | setManifestEncoding(String manifestEncoding)
Set whether or not to create an index list for classes.
|
protected void | writeIndexLikeList(List dirs, List 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. |
void | writeManifest(ZipOutputStream zOut, Manifest manifest) |
protected void | zipFile(InputStream is, ZipOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode)
Overridden from Zip class to deal with manifests and index lists. |
Parameters: newManifest
Throws: ManifestException
See Also: ZipArchiver
Parameters: zOut the zip stream representing the jar being built.
Throws: IOException thrown if there is an error while creating the index and adding it to the zip stream.
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.
See Also: ZipArchiver
Parameters: config setting for found manifest behavior.
Parameters: manifestFile the manifest file to use.