public class ZipUtils
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
ZipUtils()
Don't allow instantiation, do allow overrides.
|
Modifier and Type | Method and Description |
---|---|
static void |
zipDirectoryTree(java.lang.String inputDirectory,
java.lang.String outputZipFileName)
Zip files in a directory tree.
|
static void |
zipDirectoryTree(java.lang.String inputDirectory,
java.lang.String parentPath,
java.io.FilenameFilter filenameFilter,
java.util.zip.ZipOutputStream zipOutputStream)
Zip files in a directory tree.
|
public static void zipDirectoryTree(java.lang.String inputDirectory, java.lang.String outputZipFileName) throws java.io.IOException
inputDirectory
- The directory at which to start zipping.outputZipFileName
- The name of the output zip file.java.io.IOException
- When something goes wrong.
All the files in "inputDirectory" as well as its subdirectories are compressed and added to the output zip file specified by "outputZipFileName". The file names have subdirectory names prepended which are rooted at the specified input directory.
public static void zipDirectoryTree(java.lang.String inputDirectory, java.lang.String parentPath, java.io.FilenameFilter filenameFilter, java.util.zip.ZipOutputStream zipOutputStream) throws java.io.IOException
inputDirectory
- The directory at which to start zipping.parentPath
- The parent path to the input directory.filenameFilter
- FileNameFilter for filtering files
to zip.zipOutputStream
- ZipOutputStream to which to write
files in directory tree.
The stream must already be open
on entry to this method.java.io.IOException
- When something goes wrong.
All the files in "inputDirectory" as well as its subdirectories are compressed and added to the ZipOutputStream specified by "zipOutputStream".