Modifier and Type | Field and Description |
---|---|
(package private) int |
compressionLevel_ |
(package private) String[] |
defaultExcludes_ |
(package private) Vector |
excludes_ |
protected OutputStream |
infoOutStream_ |
(package private) long |
maxZipFileSize_ |
private String |
oldName_ |
protected PrintStream |
printOutStream_
the Out Stream for any info
|
protected boolean |
quiet_ |
protected boolean |
reallyQuiet_ |
(package private) long |
startTime_ |
protected File |
zipfile_ |
(package private) int |
zipfilenameCounter_ |
private Vector |
zipWatchers_ |
protected ZipOutputStream |
zos_
Output stream for destination zip file
|
Constructor and Description |
---|
Zipper()
Constructor for the Zipper object
|
Zipper(File[] src,
File des)
Constructor for the Zipper object
|
Zipper(File src,
File des)
Constructor for the Zipper object
|
Modifier and Type | Method and Description |
---|---|
void |
addToExcludes(String ex)
Adds a String to the excludes Vecotr that gets checked to exclude files.
|
protected ZipOutputStream |
createZipOutputStream(FileOutputStream fos) |
protected boolean |
excludedFile(File fileToCheck) |
protected boolean |
excludedFile(String fileToCheck) |
int |
getCompressionLevel_()
Gets the compressionLevel_ attribute of the Zipper object
|
OutputStream |
getInfoOutStream()
Gets the infoOutStream_ field,Which specifies where to send feedback.
|
long |
getMaxZipFileSize_()
Gets the maxZipFileSize_ attribute of the Zipper object
|
boolean |
getQuiet_()
Gets the quiet_ field.
|
protected boolean |
initZipOutputStream(File destZipFile)
Inits the Zip Output stream with the latest increment counter.
|
static void |
main(String[] args)
Main Entry point to run this class as an application usage:
Zipper |
protected void |
notifyZipWatchers(String filenameJustCompleted,
boolean done) |
void |
recursiveZip(File fo)
Wrapper method to accept a dir or individual file in the passed in File
object AND then calls the method that writes the passed file/dir to this
Zipper instances zip output stream.
|
protected void |
registerAsZipWatcher(ZipWatcher watcherClass) |
void |
setCompressionLevel_(int compressionLevel_)
Sets the compressionLevel_ attribute of the Zipper object
|
void |
setInfoOutStream(OutputStream ios)
Sets the infoOutStream_ field, Which specifies where to send feedback.
|
void |
setMaxZipFileSize_(long maxZipFileSize)
Sets the maxZipFileSize_ attribute of the Zipper object
|
void |
setQuiet_(boolean quiet_)
Sets the quiet_ field.
|
void |
writeToZip(File src)
Compresses and saves the passed file parameter to a zip file.
|
void |
writeToZipStream(String[] srcFilenameArray,
ZipOutputStream zos,
boolean recurseSubDirs)
Compresses and saves the passed files into a zip stream.
|
void |
writeToZipStream(String srcFilename,
ZipOutputStream zos,
boolean recurseSubDirs)
Compresses and saves the passed file parameter into a zip stream.
|
void |
zipFiles(File[] source,
File destination)
Encapsulates the zipping of file(s) into a zip archive.
|
protected ZipOutputStream zos_
protected PrintStream printOutStream_
protected OutputStream infoOutStream_
protected boolean quiet_
protected boolean reallyQuiet_
private Vector zipWatchers_
int zipfilenameCounter_
int compressionLevel_
long maxZipFileSize_
String[] defaultExcludes_
long startTime_
public Zipper()
Zipper(File[] src, File des)
src
- An array of files to include in the zip.des
- Description of the Parameterpublic static void main(String[] args)
Zipper
args
- 1st arg is the destination file, 2nd arg is the source filespublic boolean getQuiet_()
public void setQuiet_(boolean quiet_)
public OutputStream getInfoOutStream()
public void setInfoOutStream(OutputStream ios)
public void addToExcludes(String ex)
public void setMaxZipFileSize_(long maxZipFileSize)
maxZipFileSize_
- The new maxZipFileSize_ valuepublic long getMaxZipFileSize_()
public void setCompressionLevel_(int compressionLevel_)
compressionLevel_
- The new compressionLevel_ valueprotected boolean excludedFile(File fileToCheck)
protected boolean excludedFile(String fileToCheck)
public int getCompressionLevel_()
protected void registerAsZipWatcher(ZipWatcher watcherClass)
protected void notifyZipWatchers(String filenameJustCompleted, boolean done)
protected ZipOutputStream createZipOutputStream(FileOutputStream fos)
protected boolean initZipOutputStream(File destZipFile)
destZipFile
- Description of the Parameterpublic void zipFiles(File[] source, File destination)
source
- The files to include in the zipped file.destination
- The resultant zipped archive.public void writeToZipStream(String srcFilename, ZipOutputStream zos, boolean recurseSubDirs) throws DataFormatException, ZipException, FileNotFoundException, IOException
writeToZipStream(String[] srcFilenameArray, ZipOutputStream zos, boolean recurseSubDirs)method.
srcFilename
- The File to zip up - it can be a dir.zos
- The ZipOutputStream to comptress into.recurseSubDirs
- Flags if this method should decend into subdirs.DataFormatException
- Description of the ExceptionZipException
- Description of the ExceptionFileNotFoundException
- Description of the ExceptionIOException
- Description of the Exceptionpublic void writeToZipStream(String[] srcFilenameArray, ZipOutputStream zos, boolean recurseSubDirs) throws DataFormatException, ZipException, FileNotFoundException, IOException
srcFilename
- The Files to zip up - they can be a dir names.zos
- The ZipOutputStream to comptress into.recurseSubDirs
- Flags if this method should decend into subdirs.DataFormatException
- Description of the ExceptionZipException
- Description of the ExceptionFileNotFoundException
- Description of the ExceptionIOException
- Description of the Exceptionpublic void writeToZip(File src) throws DataFormatException, ZipException, FileNotFoundException, IOException
src
- The File to zip up - it can be a dir.DataFormatException
- Description of the ExceptionZipException
- Description of the ExceptionFileNotFoundException
- Description of the ExceptionIOException
- Description of the Exceptionpublic void recursiveZip(File fo)
fo
- The File object to zip up (can be an actual file or dir).WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses