| org.apache.tools.ant.taskdefs.MatchingTask org.apache.tools.ant.taskdefs.Zip
All known Subclasses: org.apache.tools.ant.taskdefs.Jar,
Inner Class :public static class ArchiveState | |
Method Summary | |
public void | add(ResourceCollection a) Add a collection of resources to be archived. | public void | addFileset(FileSet set) Adds a set of files. | final protected void | addParentDirs(File baseDir, String entry, ZipOutputStream zOut, String prefix, int dirMode) Ensure all parent dirs of a given entry have been added. | final protected void | addResources(FileSet fileset, Resource[] resources, ZipOutputStream zOut) Add the given resources. | final protected void | addResources(ResourceCollection rc, Resource[] resources, ZipOutputStream zOut) Add the given resources. | public void | addZipGroupFileset(FileSet set) Adds a group of zip files. | public void | addZipfileset(ZipFileSet set) Adds a set of files that can be
read from an archive and be given a prefix/fullpath. | protected void | cleanUp() Do any clean up necessary to allow this instance to be used again.
When we get here, the Zip file has been closed and all we
need to do is to reset some globals.
This method will only reset globals that have been changed
during execute(), it will not alter the attributes or nested
child elements. | protected boolean | createEmptyZip(File zipFile) | public void | execute() | public void | executeMain() Build the zip file. | protected void | finalizeZipOutputStream(ZipOutputStream zOut) | public String | getComment() | public File | getDestFile() The file to create. | public String | getEncoding() Encoding to use for filenames. | public int | getLevel() Get the compression level. | protected ArchiveState | getNonFileSetResourcesToAdd(ResourceCollection[] rcs, File zipFile, boolean needsUpdate) 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. | protected ArchiveState | getResourcesToAdd(ResourceCollection[] rcs, File zipFile, boolean needsUpdate) 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. | protected ArchiveState | getResourcesToAdd(FileSet[] filesets, File zipFile, boolean needsUpdate) 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. | protected Resource[][] | grabNonFileSetResources(ResourceCollection[] rcs) Fetch all included and not excluded resources from the collections. | protected Resource[][] | grabResources(FileSet[] filesets) Fetch all included and not excluded resources from the sets. | protected void | initZipOutputStream(ZipOutputStream zOut) | final protected boolean | isAddingNewFiles() | public boolean | isCompress() | final protected static boolean | isEmpty(Resource[][] r) Check is the resource arrays are empty. | public boolean | isInUpdateMode() | public void | reset() Makes this instance reset all attributes to their default
values and forget all children. | protected Resource[] | selectFileResources(Resource[] orig) Drops all non-file resources from the given array. | public void | setBasedir(File baseDir) Directory from which to archive files; optional. | public void | setComment(String comment) Comment to use for archive. | public void | setCompress(boolean c) | public void | setDestFile(File destFile) The file to create; required. | public void | setDuplicate(Duplicate df) Sets behavior for when a duplicate file is about to be added -
one of add , preserve or fail . | public void | setEncoding(String encoding) Encoding to use for filenames, defaults to the platform's
default encoding. | public void | setFile(File file) This is the name/location of where to
create the file. | public void | setFilesonly(boolean f) If true, emulate Sun's jar utility by not adding parent directories;
optional, defaults to false. | public void | setKeepCompression(boolean keep) Whether the original compression of entries coming from a ZIP
archive should be kept (for example when updating an archive). | public void | setLevel(int level) Set the compression level to use. | public void | setRoundUp(boolean r) Whether the file modification times will be rounded up to the
next even number of seconds.
Zip archives store file modification times with a
granularity of two seconds, so the times will either be rounded
up or down. | public void | setUpdate(boolean c) If true, updates an existing file, otherwise overwrite
any existing one; optional defaults to false. | public void | setWhenempty(WhenEmpty we) Sets behavior of the task when no files match. | public void | setZipfile(File zipFile) This is the name/location of where to
create the .zip file. | protected void | zipDir(File dir, ZipOutputStream zOut, String vPath, int mode) Add a directory to the zip stream. | protected void | zipDir(File dir, ZipOutputStream zOut, String vPath, int mode, ZipExtraField[] extra) Add a directory to the zip stream. | protected void | zipFile(InputStream in, ZipOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode) Adds a new entry to the archive, takes care of duplicates as well. | protected void | zipFile(File file, ZipOutputStream zOut, String vPath, int mode) Method that gets called when adding from java.io.File instances. |
doubleFilePass | protected boolean doubleFilePass(Code) | | |
skipWriting | protected boolean skipWriting(Code) | | |
add | public void add(ResourceCollection a)(Code) | | Add a collection of resources to be archived.
Parameters: a - the resources to archive since: Ant 1.7 |
addFileset | public void addFileset(FileSet set)(Code) | | Adds a set of files.
Parameters: set - the fileset to add |
addParentDirs | final protected void addParentDirs(File baseDir, String entry, ZipOutputStream zOut, String prefix, int dirMode) throws IOException(Code) | | Ensure all parent dirs of a given entry have been added.
Parameters: baseDir - the base directory to use (may be null) Parameters: entry - the entry name to create directories from Parameters: zOut - the stream to write to Parameters: prefix - a prefix to place on the created entries Parameters: dirMode - the directory mode throws: IOException - on error since: Ant 1.5.2 |
addResources | final protected void addResources(FileSet fileset, Resource[] resources, ZipOutputStream zOut) throws IOException(Code) | | Add the given resources.
Parameters: fileset - may give additional information like fullpath orpermissions. Parameters: resources - the resources to add Parameters: zOut - the stream to write to throws: IOException - on error since: Ant 1.5.2 |
addResources | final protected void addResources(ResourceCollection rc, Resource[] resources, ZipOutputStream zOut) throws IOException(Code) | | Add the given resources.
Parameters: rc - may give additional information like fullpath orpermissions. Parameters: resources - the resources to add Parameters: zOut - the stream to write to throws: IOException - on error since: Ant 1.7 |
addZipGroupFileset | public void addZipGroupFileset(FileSet set)(Code) | | Adds a group of zip files.
Parameters: set - the group (a fileset) to add |
addZipfileset | public void addZipfileset(ZipFileSet set)(Code) | | Adds a set of files that can be
read from an archive and be given a prefix/fullpath.
Parameters: set - the zipfileset to add |
cleanUp | protected void cleanUp()(Code) | | Do any clean up necessary to allow this instance to be used again.
When we get here, the Zip file has been closed and all we
need to do is to reset some globals.
This method will only reset globals that have been changed
during execute(), it will not alter the attributes or nested
child elements. If you want to reset the instance so that you
can later zip a completely different set of files, you must use
the reset method.
See Also: Zip.reset |
createEmptyZip | protected boolean createEmptyZip(File zipFile) throws BuildException(Code) | | Create an empty zip file
Parameters: zipFile - the zip file true for historic reasons throws: BuildException - on error |
getComment | public String getComment()(Code) | | Comment of the archive
Comment of the archive. since: Ant 1.6.3 |
getDestFile | public File getDestFile()(Code) | | The file to create.
the destination file since: Ant 1.5.2 |
getEncoding | public String getEncoding()(Code) | | Encoding to use for filenames.
the name of the encoding to use since: Ant 1.5.2 |
getLevel | public int getLevel()(Code) | | Get the compression level.
compression level. since: Ant 1.7 |
getNonFileSetResourcesToAdd | protected ArchiveState getNonFileSetResourcesToAdd(ResourceCollection[] rcs, File zipFile, boolean needsUpdate) throws BuildException(Code) | | 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 super.getResourcesToAdd and indicate with the
third arg if they already know that the archive is
out-of-date.
Parameters: rcs - The filesets to grab resources from Parameters: zipFile - intended archive file (may or may not exist) Parameters: needsUpdate - whether we already know that the archive isout-of-date. Subclasses overriding this method are supposed toset this value correctly in their call tosuper.getResourcesToAdd . an array of resources to add for each fileset passed in as wellas a flag that indicates whether the archive is uptodate. exception: BuildException - if it likes |
getResourcesToAdd | protected ArchiveState getResourcesToAdd(ResourceCollection[] rcs, File zipFile, boolean needsUpdate) throws BuildException(Code) | | 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 super.getResourcesToAdd and indicate with the
third arg if they already know that the archive is
out-of-date.
This method first delegates to getNonFileSetResourceToAdd
and then invokes the FileSet-arg version. All this to keep
backwards compatibility for subclasses that don't know how to
deal with non-FileSet ResourceCollections.
Parameters: rcs - The resource collections to grab resources from Parameters: zipFile - intended archive file (may or may not exist) Parameters: needsUpdate - whether we already know that the archive isout-of-date. Subclasses overriding this method are supposed toset this value correctly in their call tosuper.getResourcesToAdd . an array of resources to add for each fileset passed in as wellas a flag that indicates whether the archive is uptodate. exception: BuildException - if it likes since: Ant 1.7 |
getResourcesToAdd | protected ArchiveState getResourcesToAdd(FileSet[] filesets, File zipFile, boolean needsUpdate) throws BuildException(Code) | | 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 super.getResourcesToAdd and indicate with the
third arg if they already know that the archive is
out-of-date.
Parameters: filesets - The filesets to grab resources from Parameters: zipFile - intended archive file (may or may not exist) Parameters: needsUpdate - whether we already know that the archive isout-of-date. Subclasses overriding this method are supposed toset this value correctly in their call tosuper.getResourcesToAdd . an array of resources to add for each fileset passed in as wellas a flag that indicates whether the archive is uptodate. exception: BuildException - if it likes |
grabNonFileSetResources | protected Resource[][] grabNonFileSetResources(ResourceCollection[] rcs)(Code) | | Fetch all included and not excluded resources from the collections.
Included directories will precede included files.
Parameters: rcs - an array of resource collections the resources included since: Ant 1.7 |
grabResources | protected Resource[][] grabResources(FileSet[] filesets)(Code) | | Fetch all included and not excluded resources from the sets.
Included directories will precede included files.
Parameters: filesets - an array of filesets the resources included since: Ant 1.5.2 |
isAddingNewFiles | final protected boolean isAddingNewFiles()(Code) | | Indicates if the task is adding new files into the archive as opposed to
copying back unchanged files from the backup copy
true if adding new files |
isCompress | public boolean isCompress()(Code) | | Whether we want to compress the files or only store them;
true if the files are to be compressed since: Ant 1.5.2 |
isEmpty | final protected static boolean isEmpty(Resource[][] r)(Code) | | Check is the resource arrays are empty.
Parameters: r - the arrays to check true if all individual arrays are empty since: Ant 1.5.2 |
isInUpdateMode | public boolean isInUpdateMode()(Code) | | Are we updating an existing archive?
true if updating an existing archive |
reset | public void reset()(Code) | | Makes this instance reset all attributes to their default
values and forget all children.
since: Ant 1.5 See Also: Zip.cleanUp |
selectFileResources | protected Resource[] selectFileResources(Resource[] orig)(Code) | | Drops all non-file resources from the given array.
Parameters: orig - the resources to filter the filters resources since: Ant 1.6 |
setBasedir | public void setBasedir(File baseDir)(Code) | | Directory from which to archive files; optional.
Parameters: baseDir - the base directory |
setComment | public void setComment(String comment)(Code) | | Comment to use for archive.
Parameters: comment - The content of the comment. since: Ant 1.6.3 |
setCompress | public void setCompress(boolean c)(Code) | | Whether we want to compress the files or only store them;
optional, default=true;
Parameters: c - if true, compress the files |
setDestFile | public void setDestFile(File destFile)(Code) | | The file to create; required.
since: Ant 1.5 Parameters: destFile - The new destination File |
setDuplicate | public void setDuplicate(Duplicate df)(Code) | | Sets behavior for when a duplicate file is about to be added -
one of add , preserve or fail .
Possible values are: add (keep both
of the files); preserve (keep the first version
of the file found); fail halt a problem
Default for zip tasks is add
Parameters: df - a Duplicate enumerated value |
setFile | public void setFile(File file)(Code) | | This is the name/location of where to
create the file.
Parameters: file - the path of the zipFile since: Ant 1.5 |
setFilesonly | public void setFilesonly(boolean f)(Code) | | If true, emulate Sun's jar utility by not adding parent directories;
optional, defaults to false.
Parameters: f - if true, emulate sun's jar by not adding parent directories |
setKeepCompression | public void setKeepCompression(boolean keep)(Code) | | Whether the original compression of entries coming from a ZIP
archive should be kept (for example when updating an archive).
Default is false.
Parameters: keep - if true, keep the original compression since: Ant 1.6 |
setLevel | public void setLevel(int level)(Code) | | Set the compression level to use. Default is
ZipOutputStream.DEFAULT_COMPRESSION.
Parameters: level - compression level. since: Ant 1.7 |
setRoundUp | public void setRoundUp(boolean r)(Code) | | Whether the file modification times will be rounded up to the
next even number of seconds.
Zip archives store file modification times with a
granularity of two seconds, so the times will either be rounded
up or down. If you round down, the archive will always seem
out-of-date when you rerun the task, so the default is to round
up. Rounding up may lead to a different type of problems like
JSPs inside a web archive that seem to be slightly more recent
than precompiled pages, rendering precompilation useless.
Parameters: r - a boolean value since: Ant 1.6.2 |
setUpdate | public void setUpdate(boolean c)(Code) | | If true, updates an existing file, otherwise overwrite
any existing one; optional defaults to false.
Parameters: c - if true, updates an existing zip file |
setWhenempty | public void setWhenempty(WhenEmpty we)(Code) | | Sets behavior of the task when no files match.
Possible values are: fail (throw an exception
and halt the build); skip (do not create
any archive, but issue a warning); create
(make an archive with no entries).
Default for zip tasks is skip ;
for jar tasks, create .
Parameters: we - a WhenEmpty enumerated value |
setZipfile | public void setZipfile(File zipFile)(Code) | | This is the name/location of where to
create the .zip file.
Parameters: zipFile - the path of the zipFile |
zipDir | protected void zipDir(File dir, ZipOutputStream zOut, String vPath, int mode) throws IOException(Code) | | Add a directory to the zip stream.
Parameters: dir - the directort to add to the archive Parameters: zOut - the stream to write to Parameters: vPath - the name this entry shall have in the archive Parameters: mode - the Unix permissions to set. throws: IOException - on error since: Ant 1.5.2 |
zipDir | protected void zipDir(File dir, ZipOutputStream zOut, String vPath, int mode, ZipExtraField[] extra) throws IOException(Code) | | Add a directory to the zip stream.
Parameters: dir - the directort to add to the archive Parameters: zOut - the stream to write to Parameters: vPath - the name this entry shall have in the archive Parameters: mode - the Unix permissions to set. Parameters: extra - ZipExtraFields to add throws: IOException - on error since: Ant 1.6.3 |
zipFile | protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode) throws IOException(Code) | | Adds a new entry to the archive, takes care of duplicates as well.
Parameters: in - the stream to read data for the entry from. Parameters: zOut - the stream to write to. Parameters: vPath - the name this entry shall have in the archive. Parameters: lastModified - last modification time for the entry. Parameters: fromArchive - the original archive we are copying thisentry from, will be null if we are not copying from an archive. Parameters: mode - the Unix permissions to set. since: Ant 1.5.2 throws: IOException - on error |
zipFile | protected void zipFile(File file, ZipOutputStream zOut, String vPath, int mode) throws IOException(Code) | | Method that gets called when adding from java.io.File instances.
This implementation delegates to the six-arg version.
Parameters: file - the file to add to the archive Parameters: zOut - the stream to write to Parameters: vPath - the name this entry shall have in the archive Parameters: mode - the Unix permissions to set. throws: IOException - on error since: Ant 1.5.2 |
|
|