|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.plexus.logging.AbstractLogEnabled
org.codehaus.plexus.archiver.AbstractArchiver
org.codehaus.plexus.archiver.zip.AbstractZipArchiver
Field Summary | |
protected java.util.Hashtable |
addedDirs
|
protected boolean |
addingNewFiles
true when we are adding new files into the Zip file, as opposed to adding back the unchanged files |
protected java.lang.String |
archiveType
|
protected boolean |
doubleFilePass
|
protected java.lang.String |
duplicate
Deprecated. Use Archiver.setDuplicateBehavior(String) instead. |
protected java.util.Hashtable |
entries
|
protected boolean |
skipWriting
|
Fields inherited from interface org.codehaus.plexus.archiver.Archiver |
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS, ROLE |
Constructor Summary | |
AbstractZipArchiver()
|
Method Summary | |
protected void |
addParentDirs(java.io.File baseDir,
java.lang.String entry,
ZipOutputStream zOut,
java.lang.String prefix)
Ensure all parent dirs of a given entry have been added. |
protected void |
addResources(ResourceIterator resources,
ZipOutputStream zOut)
Add the given resources. |
protected void |
cleanUp()
Do any clean up necessary to allow this instance to be used again. |
protected void |
close()
|
protected boolean |
createEmptyZip(java.io.File zipFile)
Create an empty zip file |
protected void |
execute()
|
protected void |
finalizeZipOutputStream(ZipOutputStream zOut)
|
protected java.lang.String |
getArchiveType()
|
java.lang.String |
getComment()
|
java.lang.String |
getEncoding()
|
protected java.util.Map |
getZipEntryNames(java.io.File file)
|
protected void |
initZipOutputStream(ZipOutputStream zOut)
method for subclasses to override |
boolean |
isCompress()
|
protected boolean |
isFileAdded(ArchiveEntry entry,
java.util.Map entries)
|
boolean |
isFilesonly()
|
protected boolean |
isFileUpdated(ArchiveEntry entry,
java.util.Map entries)
|
boolean |
isInUpdateMode()
|
boolean |
isRoundUp()
|
boolean |
isSupportingForced()
method for subclasses to override |
void |
reset()
Makes this instance reset all attributes to their default values and forget all children. |
protected boolean |
revert(java.lang.StringBuffer messageBuffer)
|
void |
setComment(java.lang.String comment)
|
void |
setCompress(boolean compress)
|
void |
setEncoding(java.lang.String encoding)
|
void |
setFilesonly(boolean f)
If true, emulate Sun's jar utility by not adding parent directories; optional, defaults to false. |
void |
setRoundUp(boolean r)
Whether the file modification times will be rounded up to the next even number of seconds. |
void |
setUpdateMode(boolean update)
|
protected void |
zipDir(org.codehaus.plexus.components.io.resources.PlexusIoResource dir,
ZipOutputStream zOut,
java.lang.String vPath,
int mode)
|
protected void |
zipFile(ArchiveEntry entry,
ZipOutputStream zOut,
java.lang.String vPath)
Method that gets called when adding from java.io.File instances. |
protected void |
zipFile(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. |
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled |
enableLogging, setupLogger, setupLogger, setupLogger |
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.util.Hashtable entries
protected java.util.Hashtable addedDirs
protected boolean doubleFilePass
protected boolean skipWriting
protected java.lang.String duplicate
Archiver.setDuplicateBehavior(String)
instead.
protected boolean addingNewFiles
Constructor Detail |
public AbstractZipArchiver()
Method Detail |
public java.lang.String getComment()
public void setComment(java.lang.String comment)
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
public void setCompress(boolean compress)
public boolean isCompress()
public void setUpdateMode(boolean update)
public boolean isInUpdateMode()
public void setFilesonly(boolean f)
public boolean isFilesonly()
public void setRoundUp(boolean r)
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.
public boolean isRoundUp()
protected void execute() throws ArchiverException, java.io.IOException
execute
in class AbstractArchiver
ArchiverException
java.io.IOException
protected void finalizeZipOutputStream(ZipOutputStream zOut) throws java.io.IOException, ArchiverException
java.io.IOException
ArchiverException
protected java.util.Map getZipEntryNames(java.io.File file) throws java.io.IOException
java.io.IOException
protected boolean isFileAdded(ArchiveEntry entry, java.util.Map entries)
protected boolean isFileUpdated(ArchiveEntry entry, java.util.Map entries)
protected final void addResources(ResourceIterator resources, ZipOutputStream zOut) throws java.io.IOException, ArchiverException
resources
- the resources to addzOut
- the stream to write to
java.io.IOException
ArchiverException
protected final void addParentDirs(java.io.File baseDir, java.lang.String entry, ZipOutputStream zOut, java.lang.String prefix) throws java.io.IOException
java.io.IOException
protected void zipFile(java.io.InputStream in, ZipOutputStream zOut, java.lang.String vPath, long lastModified, java.io.File fromArchive, int mode) throws java.io.IOException, ArchiverException
in
- the stream to read data for the entry from.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.
java.io.IOException
ArchiverException
protected void zipFile(ArchiveEntry entry, ZipOutputStream zOut, java.lang.String vPath) throws java.io.IOException, ArchiverException
This implementation delegates to the six-arg version.
entry
- the file to add to the archivezOut
- the stream to write tovPath
- the name this entry shall have in the archive
java.io.IOException
ArchiverException
protected void zipDir(org.codehaus.plexus.components.io.resources.PlexusIoResource dir, ZipOutputStream zOut, java.lang.String vPath, int mode) throws java.io.IOException
java.io.IOException
protected boolean createEmptyZip(java.io.File zipFile) throws ArchiverException
ArchiverException
protected void cleanUp()
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.
cleanUp
in class AbstractArchiver
reset()
public void reset()
cleanUp()
protected void initZipOutputStream(ZipOutputStream zOut) throws java.io.IOException, ArchiverException
java.io.IOException
ArchiverException
public boolean isSupportingForced()
isSupportingForced
in interface Archiver
isSupportingForced
in class AbstractArchiver
protected boolean revert(java.lang.StringBuffer messageBuffer)
revert
in class AbstractArchiver
protected void close() throws java.io.IOException
close
in class AbstractArchiver
java.io.IOException
protected java.lang.String getArchiveType()
getArchiveType
in class AbstractArchiver
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |