Package com.kheops.util
Class CompressionUtils
java.lang.Object
com.kheops.util.CompressionUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
compress
(byte[] data) static byte[]
decompress
(byte[] data) static boolean
Unzips the content of the specified compressed file to the specified destination directory.static boolean
zipDirectory
(File source, File dest, boolean recursive) Zips the content of the specified directory to the specified destination file.static boolean
zipDirectory
(File source, OutputStream stream, boolean recursive)
-
Constructor Details
-
CompressionUtils
public CompressionUtils()
-
-
Method Details
-
unzipFile
Unzips the content of the specified compressed file to the specified destination directory.- Parameters:
source
- the compressed filedest
- the destination directory.- Returns:
- true if the operation completes successfully
- Throws:
IOException
- if an error occurs
-
zipDirectory
Zips the content of the specified directory to the specified destination file.- Parameters:
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 recursively- Returns:
- true if the operation completes successfully
- Throws:
IOException
- if an error occurs
-
zipDirectory
public static boolean zipDirectory(File source, OutputStream stream, boolean recursive) throws IOException - Throws:
IOException
-
compress
- Throws:
IOException
-
decompress
- Throws:
IOException
DataFormatException
-