public abstract class AbstractZipArchiver extends AbstractArchiver
| Modifier and Type | Field and Description |
|---|---|
protected Hashtable<String,String> |
addedDirs |
protected boolean |
addingNewFiles
true when we are adding new files into the Zip file, as opposed
to adding back the unchanged files
|
protected String |
archiveType |
protected boolean |
doubleFilePass |
protected String |
duplicate
Deprecated.
Use
Archiver.setDuplicateBehavior(String) instead. |
protected Hashtable<String,String> |
entries |
protected boolean |
skipWriting |
DEFAULT_DIR_MODE, DEFAULT_FILE_MODE, DEFAULT_SYMLILNK_MODE, DUPLICATES_ADD, DUPLICATES_FAIL, DUPLICATES_PRESERVE, DUPLICATES_SKIP, DUPLICATES_VALID_BEHAVIORS, ROLE| Constructor and Description |
|---|
AbstractZipArchiver() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addParentDirs(File baseDir,
String entry,
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut,
String prefix)
Ensure all parent dirs of a given entry have been added.
|
protected void |
addResources(ResourceIterator resources,
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut)
Add the given resources.
|
protected void |
cleanUp()
Do any clean up necessary to allow this instance to be used again.
|
protected void |
close() |
static long |
copy(InputStream input,
OutputStream output,
int bufferSize) |
protected boolean |
createEmptyZip(File zipFile)
Create an empty zip file
|
protected void |
execute() |
protected void |
finalizeZipOutputStream(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut) |
protected String |
getArchiveType() |
String |
getComment() |
String |
getEncoding() |
protected Map<String,Long> |
getZipEntryNames(File file) |
protected void |
initZipOutputStream(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut)
method for subclasses to override
|
boolean |
isCompress() |
protected static boolean |
isFileAdded(ArchiveEntry entry,
Map entries) |
boolean |
isFilesonly() |
protected static boolean |
isFileUpdated(ArchiveEntry entry,
Map entries) |
boolean |
isInUpdateMode() |
boolean |
isRecompressAddedZips() |
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(StringBuffer messageBuffer) |
void |
setComment(String comment) |
void |
setCompress(boolean compress) |
void |
setEncoding(String encoding) |
void |
setFilesonly(boolean f)
If true, emulate Sun's jar utility by not adding parent directories;
optional, defaults to false.
|
void |
setRecompressAddedZips(boolean recompressAddedZips) |
void |
setUpdateMode(boolean update) |
protected void |
zipDir(org.codehaus.plexus.components.io.resources.PlexusIoResource dir,
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut,
String vPath,
int mode) |
protected void |
zipFile(ArchiveEntry entry,
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut,
String vPath)
Method that gets called when adding from java.io.File instances.
|
protected void |
zipFile(InputStream in,
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut,
String vPath,
long lastModified,
File fromArchive,
int mode,
String symlinkDestination)
Adds a new entry to the archive, takes care of duplicates as well.
|
addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchivedFileSet, addArchiveFinalizer, addDirectory, addDirectory, addDirectory, addDirectory, addFile, addFile, addFileSet, addResource, addResources, addSymlink, addSymlink, asArchiveEntry, asArchiveEntry, asResourceCollection, checkForced, contextualize, createArchive, getArchiveFinalizers, getDefaultDirectoryMode, getDefaultFileMode, getDestFile, getDirectoryMode, getDirs, getDuplicateBehavior, getFileMode, getFiles, getIncludeEmptyDirs, getLogger, getOverrideDirectoryMode, getOverrideFileMode, getRawDefaultDirectoryMode, getRawDefaultFileMode, getResources, hasVirtualFiles, isForced, isIgnorePermissions, isUptodate, isUseJvmChmod, runArchiveFinalizers, setArchiveFilters, setArchiveFinalizers, setDefaultDirectoryMode, setDefaultFileMode, setDestFile, setDirectoryMode, setDotFileDirectory, setDuplicateBehavior, setFileMode, setForced, setIgnorePermissions, setIncludeEmptyDirs, setUseJvmChmod, validateprotected String archiveType
protected boolean doubleFilePass
protected boolean skipWriting
protected final String duplicate
Archiver.setDuplicateBehavior(String) instead.protected boolean addingNewFiles
public String getComment()
public void setComment(String comment)
public String getEncoding()
public void setEncoding(String encoding)
public void setCompress(boolean compress)
public boolean isCompress()
public boolean isRecompressAddedZips()
public void setRecompressAddedZips(boolean recompressAddedZips)
public void setUpdateMode(boolean update)
public boolean isInUpdateMode()
public void setFilesonly(boolean f)
f - true to emilate sun jar utilitypublic boolean isFilesonly()
protected void execute()
throws ArchiverException,
IOException
execute in class AbstractArchiverArchiverExceptionIOExceptionprotected void finalizeZipOutputStream(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut)
throws IOException,
ArchiverException
IOExceptionArchiverExceptionprotected Map<String,Long> getZipEntryNames(File file) throws IOException
IOExceptionprotected static boolean isFileAdded(ArchiveEntry entry, Map entries)
protected static boolean isFileUpdated(ArchiveEntry entry, Map entries)
protected final void addResources(ResourceIterator resources, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut) throws IOException, ArchiverException
resources - the resources to addzOut - the stream to write toIOExceptionArchiverExceptionprotected final void addParentDirs(File baseDir, String entry, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut, String prefix) throws IOException
IOExceptionpublic static long copy(InputStream input, OutputStream output, int bufferSize) throws IOException
IOExceptionprotected void zipFile(InputStream in, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode, String symlinkDestination) throws 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 thissymlinkDestination - IOExceptionArchiverExceptionprotected void zipFile(ArchiveEntry entry, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut, String vPath) throws 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 archiveIOExceptionArchiverExceptionprotected void zipDir(org.codehaus.plexus.components.io.resources.PlexusIoResource dir,
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut,
String vPath,
int mode)
throws IOException
IOExceptionprotected boolean createEmptyZip(File zipFile) throws ArchiverException
zipFile - The fileArchiverExceptionprotected 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 AbstractArchiverreset()public void reset()
cleanUp()protected void initZipOutputStream(org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zOut)
throws IOException,
ArchiverException
IOExceptionArchiverExceptionpublic boolean isSupportingForced()
isSupportingForced in interface ArchiverisSupportingForced in class AbstractArchiverArchiver.setForced(boolean),
Archiver.isForced()protected boolean revert(StringBuffer messageBuffer)
revert in class AbstractArchiverprotected void close()
throws IOException
close in class AbstractArchiverIOExceptionprotected String getArchiveType()
getArchiveType in class AbstractArchiverCopyright © 2001-2014 Codehaus. All Rights Reserved.