Class Zip
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.Task
- 
- org.apache.tools.ant.taskdefs.MatchingTask
- 
- org.apache.tools.ant.taskdefs.Zip
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- SelectorContainer
 - Direct Known Subclasses:
- Jar
 
 public class Zip extends MatchingTask Create a Zip file.- Since:
- Ant 1.1
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classZip.ArchiveStateHolds the up-to-date status and the out-of-date resources of the original archive.static classZip.DuplicatePossible behaviors when a duplicate file is added: "add", "preserve" or "fail"static classZip.UnicodeExtraFieldPolicy for creation of Unicode extra fields: never, always or not-encodeable.static classZip.WhenEmptyPossible behaviors when there are no matching files for the task: "fail", "skip", or "create".static classZip.Zip64ModeAttributeThe choices for Zip64 extensions.
 - 
Field SummaryFields Modifier and Type Field Description protected java.util.Hashtable<java.lang.String,java.lang.String>addedDirsprotected java.lang.StringarchiveTypeprotected booleandoubleFilePassIf this flag is true, execute() will run most operations twice, the first time withskipWritingset to true and the second time with setting it to false.protected java.lang.Stringduplicateprotected java.lang.StringemptyBehaviorprotected java.util.Hashtable<java.lang.String,java.lang.String>entriesprotected booleanskipWritingwhether the methods should just perform some sort of dry-run.protected java.io.FilezipFile- 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTaskfileset
 - 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Constructor Description Zip()
 - 
Method SummaryModifier and Type Method Description voidadd(ResourceCollection a)Add a collection of resources to be archived.voidaddFileset(FileSet set)Adds a set of files.protected voidaddParentDirs(java.io.File baseDir, java.lang.String entry, ZipOutputStream zOut, java.lang.String prefix, int dirMode)Ensure all parent dirs of a given entry have been added.protected voidaddResources(FileSet fileset, Resource[] resources, ZipOutputStream zOut)Add the given resources.protected voidaddResources(ResourceCollection rc, Resource[] resources, ZipOutputStream zOut)Add the given resources.voidaddZipfileset(ZipFileSet set)Adds a set of files that can be read from an archive and be given a prefix/fullpath.voidaddZipGroupFileset(FileSet set)Adds a group of zip files.protected voidcleanUp()Do any clean up necessary to allow this instance to be used again.protected booleancreateEmptyZip(java.io.File zipFile)Create an empty zip filevoidexecute()validate and buildvoidexecuteMain()Build the zip file.protected voidfinalizeZipOutputStream(ZipOutputStream zOut)method for subclasses to overridejava.lang.StringgetComment()Comment of the archiveZip.UnicodeExtraFieldgetCreateUnicodeExtraFields()Whether Unicode extra fields will be created.protected ZipExtraField[]getCurrentExtraFields()Provides the extra fields for the zip entry currently being added to the archive - if any.java.io.FilegetDestFile()The file to create.java.lang.StringgetEncoding()Encoding to use for filenames.booleangetFallBackToUTF8()Whether to fall back to UTF-8 if a name cannot be encoded using the specified encoding.intgetLevel()Get the compression level.java.lang.StringgetModificationtime()The file modification time previously provided tosetModificationtime(String)ornullif unset.protected Zip.ArchiveStategetNonFileSetResourcesToAdd(ResourceCollection[] rcs, java.io.File zipFile, boolean needsUpdate)Collect the resources that are newer than the corresponding entries (or missing) in the original archive.booleangetPreserve0Permissions()Assume 0 Unix mode is intentional.protected Zip.ArchiveStategetResourcesToAdd(FileSet[] filesets, java.io.File zipFile, boolean needsUpdate)Collect the resources that are newer than the corresponding entries (or missing) in the original archive.protected Zip.ArchiveStategetResourcesToAdd(ResourceCollection[] rcs, java.io.File zipFile, boolean needsUpdate)Collect the resources that are newer than the corresponding entries (or missing) in the original archive.booleangetUseLanguageEnodingFlag()Whether the language encoding flag will be used.Zip.Zip64ModeAttributegetZip64Mode()Whether Zip64 extensions will be used.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 booleanhasUpdatedFile()Get the value of the updatedFile attribute.protected voidinitZipOutputStream(ZipOutputStream zOut)method for subclasses to overrideprotected booleanisAddingNewFiles()Indicates if the task is adding new files into the archive as opposed to copying back unchanged files from the backup copybooleanisCompress()Whether we want to compress the files or only store them;protected static booleanisEmpty(Resource[][] r)Check is the resource arrays are empty.protected booleanisFirstPass()Whether this is the first time the archive building methods are invoked.booleanisInUpdateMode()Are we updating an existing archive?protected voidlogWhenWriting(java.lang.String msg, int level)Logs a message at the given output level, but only if this is the pass that will actually create the archive.voidreset()Makes this instance reset all attributes to their default values and forget all children.protected Resource[]selectDirectoryResources(Resource[] orig)Drops all non-directory resources from the given array.protected Resource[]selectFileResources(Resource[] orig)Drops all non-file resources from the given array.protected Resource[]selectResources(Resource[] orig, ResourceSelector selector)Drops all resources from the given array that are not selectedvoidsetBasedir(java.io.File baseDir)Directory from which to archive files; optional.voidsetComment(java.lang.String comment)Comment to use for archive.voidsetCompress(boolean c)Whether we want to compress the files or only store them; optional, default=true;voidsetCreateUnicodeExtraFields(Zip.UnicodeExtraField b)Whether Unicode extra fields will be created.protected voidsetCurrentExtraFields(ZipExtraField[] extra)Sets the extra fields for the zip entry currently being added to the archive - if any.voidsetDestFile(java.io.File destFile)The file to create; required.voidsetDuplicate(Zip.Duplicate df)Sets behavior for when a duplicate file is about to be added - one ofadd,preserveorfail.voidsetEncoding(java.lang.String encoding)Encoding to use for filenames, defaults to the platform's default encoding.voidsetFallBackToUTF8(boolean b)Whether to fall back to UTF-8 if a name cannot be encoded using the specified encoding.voidsetFile(java.io.File file)Deprecated.since 1.5.x.voidsetFilesonly(boolean f)If true, emulate Sun's jar utility by not adding parent directories; optional, defaults to false.voidsetKeepCompression(boolean keep)Whether the original compression of entries coming from a ZIP archive should be kept (for example when updating an archive).voidsetLevel(int level)Set the compression level to use.voidsetModificationtime(java.lang.String time)Set all stored file modification times totime.voidsetPreserve0Permissions(boolean b)Assume 0 Unix mode is intentional.voidsetRoundUp(boolean r)Whether the file modification times will be rounded up to the next even number of seconds.voidsetUpdate(boolean c)If true, updates an existing file, otherwise overwrite any existing one; optional defaults to false.voidsetUseLanguageEncodingFlag(boolean b)Whether to set the language encoding flag.voidsetWhenempty(Zip.WhenEmpty we)Sets behavior of the task when no files match.voidsetZip64Mode(Zip.Zip64ModeAttribute b)Whether Zip64 extensions should be used.voidsetZipfile(java.io.File zipFile)Deprecated.since 1.5.x.protected voidzipDir(java.io.File dir, ZipOutputStream zOut, java.lang.String vPath, int mode)Add a directory to the zip stream.protected voidzipDir(java.io.File dir, ZipOutputStream zOut, java.lang.String vPath, int mode, ZipExtraField[] extra)Add a directory to the zip stream.protected voidzipDir(Resource dir, ZipOutputStream zOut, java.lang.String vPath, int mode, ZipExtraField[] extra)Add a directory to the zip stream.protected voidzipFile(java.io.File file, ZipOutputStream zOut, java.lang.String vPath, int mode)Method that gets called when adding fromjava.io.Fileinstances.protected voidzipFile(java.io.InputStream in, ZipOutputStream zOut, java.lang.String vPath, long lastModified, java.io.File fromArchive, int mode)Adds a new entry to the archive, takes care of duplicates as well.protected voidzipFile(java.io.InputStream in, ZipOutputStream zOut, java.lang.String vPath, long lastModified, java.io.File fromArchive, int mode, ZipExtraField[] extra)Adds a new entry to the archive, takes care of duplicates as well.- 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTaskadd, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
 - 
Methods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation
 
- 
 
- 
- 
- 
Field Detail- 
zipFileprotected java.io.File zipFile 
 - 
entriesprotected java.util.Hashtable<java.lang.String,java.lang.String> entries 
 - 
duplicateprotected java.lang.String duplicate 
 - 
archiveTypeprotected java.lang.String archiveType 
 - 
emptyBehaviorprotected java.lang.String emptyBehavior 
 - 
addedDirsprotected java.util.Hashtable<java.lang.String,java.lang.String> addedDirs 
 - 
doubleFilePassprotected boolean doubleFilePass If this flag is true, execute() will run most operations twice, the first time withskipWritingset to true and the second time with setting it to false.The only situation in Ant's current code base where this is ever going to be true is if the jar task has been configured with a filesetmanifest other than "skip". 
 - 
skipWritingprotected boolean skipWriting whether the methods should just perform some sort of dry-run.Will only ever be true in the first pass if the task performs two passes because doubleFilePassis true.
 
- 
 - 
Method Detail- 
isFirstPassprotected final boolean isFirstPass() Whether this is the first time the archive building methods are invoked.- Returns:
- true if either doubleFilePassis false orskipWritingis true.
- Since:
- Ant 1.8.0
 
 - 
setZipfile@Deprecated public void setZipfile(java.io.File zipFile) Deprecated.since 1.5.x. Use setDestFile(File) instead.This is the name/location of where to create the .zip file.- Parameters:
- zipFile- the path of the zipFile
 
 - 
setFile@Deprecated public void setFile(java.io.File file) Deprecated.since 1.5.x. Use setDestFile(File) instead.This is the name/location of where to create the file.- Parameters:
- file- the path of the zipFile
- Since:
- Ant 1.5
 
 - 
setDestFilepublic void setDestFile(java.io.File destFile) The file to create; required.- Parameters:
- destFile- The new destination File
- Since:
- Ant 1.5
 
 - 
getDestFilepublic java.io.File getDestFile() The file to create.- Returns:
- the destination file
- Since:
- Ant 1.5.2
 
 - 
setBasedirpublic void setBasedir(java.io.File baseDir) Directory from which to archive files; optional.- Parameters:
- baseDir- the base directory
 
 - 
setCompresspublic void setCompress(boolean c) Whether we want to compress the files or only store them; optional, default=true;- Parameters:
- c- if true, compress the files
 
 - 
isCompresspublic boolean isCompress() Whether we want to compress the files or only store them;- Returns:
- true if the files are to be compressed
- Since:
- Ant 1.5.2
 
 - 
setFilesonlypublic void setFilesonly(boolean f) 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
 
 - 
setUpdatepublic void setUpdate(boolean c) If true, updates an existing file, otherwise overwrite any existing one; optional defaults to false.- Parameters:
- c- if true, updates an existing zip file
 
 - 
isInUpdateModepublic boolean isInUpdateMode() Are we updating an existing archive?- Returns:
- true if updating an existing archive
 
 - 
addFilesetpublic void addFileset(FileSet set) Adds a set of files.- Parameters:
- set- the fileset to add
 
 - 
addZipfilesetpublic void addZipfileset(ZipFileSet set) Adds a set of files that can be read from an archive and be given a prefix/fullpath.- Parameters:
- set- the zipfileset to add
 
 - 
addpublic void add(ResourceCollection a) Add a collection of resources to be archived.- Parameters:
- a- the resources to archive
- Since:
- Ant 1.7
 
 - 
addZipGroupFilesetpublic void addZipGroupFileset(FileSet set) Adds a group of zip files.- Parameters:
- set- the group (a fileset) to add
 
 - 
setDuplicatepublic void setDuplicate(Zip.Duplicate df) Sets behavior for when a duplicate file is about to be added - one ofadd,preserveorfail. Possible values are:add(keep both of the files);preserve(keep the first version of the file found);failhalt a problem Default for zip tasks isadd- Parameters:
- df- a- Duplicateenumerated value
 
 - 
setWhenemptypublic void setWhenempty(Zip.WhenEmpty we) 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 isskip; for jar tasks,create.- Parameters:
- we- a- WhenEmptyenumerated value
 
 - 
setEncodingpublic void setEncoding(java.lang.String encoding) Encoding to use for filenames, defaults to the platform's default encoding.For a list of possible values see https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html. - Parameters:
- encoding- the encoding name
 
 - 
getEncodingpublic java.lang.String getEncoding() Encoding to use for filenames.- Returns:
- the name of the encoding to use
- Since:
- Ant 1.5.2
 
 - 
setKeepCompressionpublic void setKeepCompression(boolean keep) 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
 
 - 
setCommentpublic void setComment(java.lang.String comment) Comment to use for archive.- Parameters:
- comment- The content of the comment.
- Since:
- Ant 1.6.3
 
 - 
getCommentpublic java.lang.String getComment() Comment of the archive- Returns:
- Comment of the archive.
- Since:
- Ant 1.6.3
 
 - 
setLevelpublic void setLevel(int level) Set the compression level to use. Default is ZipOutputStream.DEFAULT_COMPRESSION.- Parameters:
- level- compression level.
- Since:
- Ant 1.7
 
 - 
getLevelpublic int getLevel() Get the compression level.- Returns:
- compression level.
- Since:
- Ant 1.7
 
 - 
setRoundUppublic 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. 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- booleanvalue
- Since:
- Ant 1.6.2
 
 - 
setPreserve0Permissionspublic void setPreserve0Permissions(boolean b) Assume 0 Unix mode is intentional.- Parameters:
- b- boolean
- Since:
- Ant 1.8.0
 
 - 
getPreserve0Permissionspublic boolean getPreserve0Permissions() Assume 0 Unix mode is intentional.- Returns:
- boolean
- Since:
- Ant 1.8.0
 
 - 
setUseLanguageEncodingFlagpublic void setUseLanguageEncodingFlag(boolean b) Whether to set the language encoding flag.- Parameters:
- b- boolean
- Since:
- Ant 1.8.0
 
 - 
getUseLanguageEnodingFlagpublic boolean getUseLanguageEnodingFlag() Whether the language encoding flag will be used.- Returns:
- boolean
- Since:
- Ant 1.8.0
 
 - 
setCreateUnicodeExtraFieldspublic void setCreateUnicodeExtraFields(Zip.UnicodeExtraField b) Whether Unicode extra fields will be created.- Parameters:
- b- boolean
- Since:
- Ant 1.8.0
 
 - 
getCreateUnicodeExtraFieldspublic Zip.UnicodeExtraField getCreateUnicodeExtraFields() Whether Unicode extra fields will be created.- Returns:
- boolean
- Since:
- Ant 1.8.0
 
 - 
setFallBackToUTF8public void setFallBackToUTF8(boolean b) Whether to fall back to UTF-8 if a name cannot be encoded using the specified encoding.Defaults to false. - Parameters:
- b- boolean
- Since:
- Ant 1.8.0
 
 - 
getFallBackToUTF8public boolean getFallBackToUTF8() Whether to fall back to UTF-8 if a name cannot be encoded using the specified encoding.- Returns:
- boolean
- Since:
- Ant 1.8.0
 
 - 
setZip64Modepublic void setZip64Mode(Zip.Zip64ModeAttribute b) Whether Zip64 extensions should be used.- Parameters:
- b- boolean
- Since:
- Ant 1.9.1
 
 - 
getZip64Modepublic Zip.Zip64ModeAttribute getZip64Mode() Whether Zip64 extensions will be used.- Returns:
- boolean
- Since:
- Ant 1.9.1
 
 - 
setModificationtimepublic void setModificationtime(java.lang.String time) Set all stored file modification times totime.- Parameters:
- time- Milliseconds since 1970-01-01 00:00, or- YYYY-MM-DD{T/ }HH:MM[:SS[.SSS]][ ][±ZZ[[:]ZZ]], or- MM/DD/YYYY HH:MM[:SS] {AM/PM}, where {a/b} indicates that you must choose one of a or b, and [c] indicates that you may use or omit c. ±ZZZZ is the timezone offset, and may be literally "Z" to mean GMT.
- Since:
- Ant 1.10.2
 
 - 
getModificationtimepublic java.lang.String getModificationtime() The file modification time previously provided tosetModificationtime(String)ornullif unset.- Returns:
- String
- Since:
- Ant 1.10.2
 
 - 
executepublic void execute() throws BuildExceptionvalidate and build- Overrides:
- executein class- Task
- Throws:
- BuildException- on error
 
 - 
hasUpdatedFileprotected boolean hasUpdatedFile() Get the value of the updatedFile attribute. This should only be called after executeMain has been called.- Returns:
- true if executeMain has written to the zip file.
 
 - 
executeMainpublic void executeMain() throws BuildExceptionBuild the zip file. This is called twice if doubleFilePass is true.- Throws:
- BuildException- on error
 
 - 
isAddingNewFilesprotected final boolean isAddingNewFiles() Indicates if the task is adding new files into the archive as opposed to copying back unchanged files from the backup copy- Returns:
- true if adding new files
 
 - 
addResourcesprotected final void addResources(FileSet fileset, Resource[] resources, ZipOutputStream zOut) throws java.io.IOException Add the given resources.- Parameters:
- fileset- may give additional information like fullpath or permissions.
- resources- the resources to add
- zOut- the stream to write to
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.5.2
 
 - 
addResourcesprotected final void addResources(ResourceCollection rc, Resource[] resources, ZipOutputStream zOut) throws java.io.IOException Add the given resources.- Parameters:
- rc- may give additional information like fullpath or permissions.
- resources- the resources to add
- zOut- the stream to write to
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.7
 
 - 
initZipOutputStreamprotected void initZipOutputStream(ZipOutputStream zOut) throws java.io.IOException, BuildException method for subclasses to override- Parameters:
- zOut- the zip output stream
- Throws:
- java.io.IOException- on output error
- BuildException- on other errors
 
 - 
finalizeZipOutputStreamprotected void finalizeZipOutputStream(ZipOutputStream zOut) throws java.io.IOException, BuildException method for subclasses to override- Parameters:
- zOut- the zip output stream
- Throws:
- java.io.IOException- on output error
- BuildException- on other errors
 
 - 
createEmptyZipprotected boolean createEmptyZip(java.io.File zipFile) throws BuildExceptionCreate an empty zip file- Parameters:
- zipFile- the zip file
- Returns:
- true for historic reasons
- Throws:
- BuildException- on error
 
 - 
getResourcesToAddprotected Zip.ArchiveState getResourcesToAdd(ResourceCollection[] rcs, java.io.File zipFile, boolean needsUpdate) throws BuildException 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.getResourcesToAddand indicate with the third arg if they already know that the archive is out-of-date.This method first delegates to getNonFileSetResourcesToAdd 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
- zipFile- intended archive file (may or may not exist)
- needsUpdate- 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.
- Returns:
- an array of resources to add for each fileset passed in as well as a flag that indicates whether the archive is uptodate.
- Throws:
- BuildException- if it likes
- Since:
- Ant 1.7
 
 - 
getResourcesToAddprotected Zip.ArchiveState getResourcesToAdd(FileSet[] filesets, java.io.File zipFile, boolean needsUpdate) throws BuildException 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.getResourcesToAddand indicate with the third arg if they already know that the archive is out-of-date.- Parameters:
- filesets- The filesets to grab resources from
- zipFile- intended archive file (may or may not exist)
- needsUpdate- 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.
- Returns:
- an array of resources to add for each fileset passed in as well as a flag that indicates whether the archive is uptodate.
- Throws:
- BuildException- if it likes
 
 - 
getNonFileSetResourcesToAddprotected Zip.ArchiveState getNonFileSetResourcesToAdd(ResourceCollection[] rcs, java.io.File zipFile, boolean needsUpdate) throws BuildException 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.getResourcesToAddand indicate with the third arg if they already know that the archive is out-of-date.- Parameters:
- rcs- The filesets to grab resources from
- zipFile- intended archive file (may or may not exist)
- needsUpdate- 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.
- Returns:
- an array of resources to add for each fileset passed in as well as a flag that indicates whether the archive is uptodate.
- Throws:
- BuildException- if it likes
 
 - 
grabResourcesprotected Resource[][] grabResources(FileSet[] filesets) Fetch all included and not excluded resources from the sets.Included directories will precede included files. - Parameters:
- filesets- an array of filesets
- Returns:
- the resources included
- Since:
- Ant 1.5.2
 
 - 
grabNonFileSetResourcesprotected Resource[][] grabNonFileSetResources(ResourceCollection[] rcs) Fetch all included and not excluded resources from the collections.Included directories will precede included files. - Parameters:
- rcs- an array of resource collections
- Returns:
- the resources included
- Since:
- Ant 1.7
 
 - 
zipDirprotected void zipDir(java.io.File dir, ZipOutputStream zOut, java.lang.String vPath, int mode) throws java.io.IOExceptionAdd a directory to the zip stream.- Parameters:
- dir- the directory to add to the archive
- zOut- the stream to write to
- vPath- the name this entry shall have in the archive
- mode- the Unix permissions to set.
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.5.2
 
 - 
zipDirprotected void zipDir(java.io.File dir, ZipOutputStream zOut, java.lang.String vPath, int mode, ZipExtraField[] extra) throws java.io.IOExceptionAdd a directory to the zip stream.- Parameters:
- dir- the directory to add to the archive
- zOut- the stream to write to
- vPath- the name this entry shall have in the archive
- mode- the Unix permissions to set.
- extra- ZipExtraFields to add
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.6.3
 
 - 
zipDirprotected void zipDir(Resource dir, ZipOutputStream zOut, java.lang.String vPath, int mode, ZipExtraField[] extra) throws java.io.IOException Add a directory to the zip stream.- Parameters:
- dir- the directory to add to the archive
- zOut- the stream to write to
- vPath- the name this entry shall have in the archive
- mode- the Unix permissions to set.
- extra- ZipExtraFields to add
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.8.0
 
 - 
getCurrentExtraFieldsprotected final ZipExtraField[] getCurrentExtraFields() Provides the extra fields for the zip entry currently being added to the archive - if any.- Returns:
- ZipExtraField[]
- Since:
- Ant 1.8.0
 
 - 
setCurrentExtraFieldsprotected final void setCurrentExtraFields(ZipExtraField[] extra) Sets the extra fields for the zip entry currently being added to the archive - if any.- Parameters:
- extra- ZipExtraField[]
- Since:
- Ant 1.8.0
 
 - 
zipFileprotected void zipFile(java.io.InputStream in, ZipOutputStream zOut, java.lang.String vPath, long lastModified, java.io.File fromArchive, int mode) throws java.io.IOExceptionAdds a new entry to the archive, takes care of duplicates as well.- Parameters:
- in- the stream to read data for the entry from. The caller of the method is responsible for closing the stream.
- zOut- the stream to write to.
- vPath- the name this entry shall have in the archive.
- lastModified- last modification time for the entry.
- fromArchive- the original archive we are copying this entry from, will be null if we are not copying from an archive.
- mode- the Unix permissions to set.
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.5.2
 
 - 
zipFileprotected final void zipFile(java.io.InputStream in, ZipOutputStream zOut, java.lang.String vPath, long lastModified, java.io.File fromArchive, int mode, ZipExtraField[] extra) throws java.io.IOExceptionAdds a new entry to the archive, takes care of duplicates as well.- Parameters:
- in- the stream to read data for the entry from. The caller of the method is responsible for closing the stream.
- zOut- the stream to write to.
- vPath- the name this entry shall have in the archive.
- lastModified- last modification time for the entry.
- fromArchive- the original archive we are copying this entry from, will be null if we are not copying from an archive.
- mode- the Unix permissions to set.
- extra- ZipExtraFields to add
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.8.0
 
 - 
zipFileprotected void zipFile(java.io.File file, ZipOutputStream zOut, java.lang.String vPath, int mode) throws java.io.IOExceptionMethod that gets called when adding fromjava.io.Fileinstances.This implementation delegates to the six-arg version. - Parameters:
- file- the file to add to the archive
- zOut- the stream to write to
- vPath- the name this entry shall have in the archive
- mode- the Unix permissions to set.
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.5.2
 
 - 
addParentDirsprotected final void addParentDirs(java.io.File baseDir, java.lang.String entry, ZipOutputStream zOut, java.lang.String prefix, int dirMode) throws java.io.IOExceptionEnsure all parent dirs of a given entry have been added.- Parameters:
- baseDir- the base directory to use (may be null)
- entry- the entry name to create directories from
- zOut- the stream to write to
- prefix- a prefix to place on the created entries
- dirMode- the directory mode
- Throws:
- java.io.IOException- on error
- Since:
- Ant 1.5.2
 
 - 
cleanUpprotected 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. 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:
- reset()
 
 - 
resetpublic void reset() Makes this instance reset all attributes to their default values and forget all children.- Since:
- Ant 1.5
- See Also:
- cleanUp()
 
 - 
isEmptyprotected static final boolean isEmpty(Resource[][] r) Check is the resource arrays are empty.- Parameters:
- r- the arrays to check
- Returns:
- true if all individual arrays are empty
- Since:
- Ant 1.5.2
 
 - 
selectFileResourcesprotected Resource[] selectFileResources(Resource[] orig) Drops all non-file resources from the given array.- Parameters:
- orig- the resources to filter
- Returns:
- the filters resources
- Since:
- Ant 1.6
 
 - 
selectDirectoryResourcesprotected Resource[] selectDirectoryResources(Resource[] orig) Drops all non-directory resources from the given array.- Parameters:
- orig- the resources to filter
- Returns:
- the filters resources
- Since:
- Ant 1.8.0
 
 - 
selectResourcesprotected Resource[] selectResources(Resource[] orig, ResourceSelector selector) Drops all resources from the given array that are not selected- Parameters:
- orig- the resources to filter
- selector- ResourceSelector
- Returns:
- the filters resources
- Since:
- Ant 1.8.0
 
 - 
logWhenWritingprotected void logWhenWriting(java.lang.String msg, int level)Logs a message at the given output level, but only if this is the pass that will actually create the archive.- Parameters:
- msg- String
- level- int
- Since:
- Ant 1.8.0
 
 
- 
 
-