public class CompressionUtils
extends java.lang.Object
Constructor and Description |
---|
CompressionUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
compress(byte[] data) |
static byte[] |
decompress(byte[] data) |
static boolean |
unzipFile(java.io.File source,
java.io.File dest)
Unzips the content of the specified compressed file to the specified
destination directory.
|
static boolean |
zipDirectory(java.io.File source,
java.io.File dest,
boolean recursive)
Zips the content of the specified directory to the specified destination
file.
|
static boolean |
zipDirectory(java.io.File source,
java.io.OutputStream stream,
boolean recursive) |
public static boolean unzipFile(java.io.File source, java.io.File dest) throws java.io.IOException
source
- the compressed filedest
- the destination directory.java.io.IOException
- if an error occurspublic static boolean zipDirectory(java.io.File source, java.io.File dest, boolean recursive) throws java.io.IOException
source
- the source directorydest
- the destination compressed file. If the file already exists, it
will be overwritten.recursive
- zip the content of the source directory recursivelyjava.io.IOException
- if an error occurspublic static boolean zipDirectory(java.io.File source, java.io.OutputStream stream, boolean recursive) throws java.io.IOException
java.io.IOException
public static byte[] compress(byte[] data) throws java.io.IOException
java.io.IOException
public static byte[] decompress(byte[] data) throws java.io.IOException, java.util.zip.DataFormatException
java.io.IOException
java.util.zip.DataFormatException