|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.Task | +--org.apache.tools.ant.taskdefs.MatchingTask | +--org.apache.tools.ant.taskdefs.Zip
Create a ZIP archive.
Field Summary | |
protected java.lang.String |
archiveType
|
protected java.lang.String |
emptyBehavior
|
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
fileset, useDefaultExcludes |
Fields inherited from class org.apache.tools.ant.Task |
description, location, project, target, taskName, taskType, wrapper |
Constructor Summary | |
Zip()
|
Method Summary | |
protected void |
addFiles(FileScanner scanner,
java.util.zip.ZipOutputStream zOut,
java.lang.String prefix,
java.lang.String fullpath)
Add all files of the given FileScanner to the ZipOutputStream prependig the given prefix to each filename. |
protected void |
addFiles(java.util.Vector filesets,
java.util.zip.ZipOutputStream zOut)
Iterate over the given Vector of (zip)filesets and add all files to the ZipOutputStream using the given prefix. |
void |
addFileset(FileSet set)
Adds a set of files (nested fileset attribute). |
protected void |
addParentDirs(java.io.File baseDir,
java.lang.String entry,
java.util.zip.ZipOutputStream zOut,
java.lang.String prefix)
Ensure all parent dirs of a given entry have been added. |
protected void |
addZipEntries(ZipFileSet fs,
DirectoryScanner ds,
java.util.zip.ZipOutputStream zOut,
java.lang.String prefix)
|
void |
addZipfileset(ZipFileSet set)
Adds a set of files (nested zipfileset attribute) 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. |
void |
execute()
Called by the project to let the task do it's work. |
protected static java.lang.String[][] |
grabFileNames(FileScanner[] scanners)
|
protected static java.io.File[] |
grabFiles(FileScanner[] scanners)
|
protected static java.io.File[] |
grabFiles(FileScanner[] scanners,
java.lang.String[][] fileNames)
|
protected void |
initZipOutputStream(java.util.zip.ZipOutputStream zOut)
|
protected boolean |
isUpToDate(FileScanner[] scanners,
java.io.File zipFile)
Check whether the archive is up-to-date; and handle behavior for empty archives. |
void |
setBasedir(java.io.File baseDir)
This is the base directory to look in for things to zip. |
void |
setCompress(boolean c)
Sets whether we want to compress the files or only store them. |
void |
setWhenempty(java.lang.String we)
Sets behavior of the task when no files match. |
void |
setZipfile(java.io.File zipFile)
This is the name/location of where to create the .zip file. |
protected void |
zipDir(java.io.File dir,
java.util.zip.ZipOutputStream zOut,
java.lang.String vPath)
|
protected void |
zipFile(java.io.File file,
java.util.zip.ZipOutputStream zOut,
java.lang.String vPath)
|
protected void |
zipFile(java.io.InputStream in,
java.util.zip.ZipOutputStream zOut,
java.lang.String vPath,
long lastModified)
|
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
createExclude, createInclude, createPatternSet, getDirectoryScanner, setDefaultexcludes, setExcludes, setExcludesfile, setIncludes, setIncludesfile, XsetIgnore, XsetItems |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getTaskName, init, log, log, maybeConfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String archiveType
protected java.lang.String emptyBehavior
Constructor Detail |
public Zip()
Method Detail |
public void setZipfile(java.io.File zipFile)
public void setBasedir(java.io.File baseDir)
public void setCompress(boolean c)
public void addFileset(FileSet set)
public void addZipfileset(ZipFileSet set)
public void setWhenempty(java.lang.String we) throws BuildException
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
.public void execute() throws BuildException
Task
execute
in class Task
org.apache.tools.ant.Task
BuildException
- if someting goes wrong with the buildprotected void addFiles(FileScanner scanner, java.util.zip.ZipOutputStream zOut, java.lang.String prefix, java.lang.String fullpath) throws java.io.IOException
Ensure parent directories have been added as well.
protected void addZipEntries(ZipFileSet fs, DirectoryScanner ds, java.util.zip.ZipOutputStream zOut, java.lang.String prefix) throws java.io.IOException
protected void initZipOutputStream(java.util.zip.ZipOutputStream zOut) throws java.io.IOException, BuildException
protected boolean isUpToDate(FileScanner[] scanners, java.io.File zipFile) throws BuildException
scanners
- list of prepared scanners containing files to archivezipFile
- intended archive file (may or may not exist)BuildException
- if it likesprotected static java.io.File[] grabFiles(FileScanner[] scanners)
protected static java.io.File[] grabFiles(FileScanner[] scanners, java.lang.String[][] fileNames)
protected static java.lang.String[][] grabFileNames(FileScanner[] scanners)
protected void zipDir(java.io.File dir, java.util.zip.ZipOutputStream zOut, java.lang.String vPath) throws java.io.IOException
protected void zipFile(java.io.InputStream in, java.util.zip.ZipOutputStream zOut, java.lang.String vPath, long lastModified) throws java.io.IOException
protected void zipFile(java.io.File file, java.util.zip.ZipOutputStream zOut, java.lang.String vPath) throws java.io.IOException
protected void addParentDirs(java.io.File baseDir, java.lang.String entry, java.util.zip.ZipOutputStream zOut, java.lang.String prefix) throws java.io.IOException
protected void addFiles(java.util.Vector filesets, java.util.zip.ZipOutputStream zOut) throws java.io.IOException
protected void cleanUp()
When we get here, the Zip file has been closed and all we need to do is to reset some globals.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |