public final class ZipExtensions
extends java.lang.Object
ZipExtensions provides functionality for ziping and unzipping files.| Modifier and Type | Method and Description |
|---|---|
static void |
extractZipEntry(java.util.zip.ZipFile zipFile,
java.util.zip.ZipEntry target,
java.io.File toDirectory)
Extract zip entry.
|
static boolean |
isZip(java.lang.String filename)
Checks if the given filename is a zip-file.
|
static void |
unzip(java.util.zip.ZipFile zipFile,
java.io.File toDir)
Unzip.
|
static void |
zip(java.io.File fileToZip,
java.io.File zipFile)
Zip the given file.
|
static void |
zip(java.io.File dirToZip,
java.io.File zipFile,
java.io.FilenameFilter filter)
Zip the given file.
|
static void |
zip(java.io.File dirToZip,
java.io.File zipFile,
java.io.FilenameFilter filter,
boolean createFile)
Zip the given file.
|
public static void extractZipEntry(java.util.zip.ZipFile zipFile,
java.util.zip.ZipEntry target,
java.io.File toDirectory)
throws java.io.IOException
zipFile - the zip filetarget - the targettoDirectory - the to directoryjava.io.IOException - Signals that an I/O exception has occurred.public static boolean isZip(java.lang.String filename)
filename - The filename to check.public static void unzip(java.util.zip.ZipFile zipFile,
java.io.File toDir)
throws java.io.IOException
zipFile - the zip filetoDir - the to dirjava.io.IOException - Signals that an I/O exception has occurred.public static void zip(java.io.File fileToZip,
java.io.File zipFile)
throws java.io.FileNotFoundException,
java.io.IOException,
FileDoesNotExistException
fileToZip - the file to zip.zipFile - the zip filejava.io.FileNotFoundException - the file not found exceptionjava.io.IOException - Signals that an I/O exception has occurred.FileDoesNotExistException - the file does not exist exceptionpublic static void zip(java.io.File dirToZip,
java.io.File zipFile,
java.io.FilenameFilter filter)
throws java.io.FileNotFoundException,
java.io.IOException,
FileDoesNotExistException
dirToZip - the dir to zipzipFile - the zip filefilter - the filterjava.io.FileNotFoundException - the file not found exceptionjava.io.IOException - Signals that an I/O exception has occurred.FileDoesNotExistException - the file does not exist exceptionpublic static void zip(java.io.File dirToZip,
java.io.File zipFile,
java.io.FilenameFilter filter,
boolean createFile)
throws java.io.FileNotFoundException,
java.io.IOException,
FileDoesNotExistException
dirToZip - the dir to zipzipFile - the zip filefilter - the filtercreateFile - the create filejava.io.FileNotFoundException - the file not found exceptionjava.io.IOException - Signals that an I/O exception has occurred.FileDoesNotExistException - the file does not exist exception