I would like to recommend you use console tool for compressing/uncompressing data if its acceptable.
Almost all java lib have a lot of bad sides : lower perfomance, using much more memory and more CPU.
I had a problem with uncompressing few big files (to reproduce, file should be more than 2 GB)
I use next code to uncompress list of compressed files.
public int extractFiles(final String zipFile, final File folder, final String[] neededFiles) throws IOException {
try {
final String filesString = StringUtils.join(neededFiles, " ");
final String command = "/bin/tar -xvf " + zipFile + " " + filesString;
logger.info("Start unzipping: {} into the folder {}", command, folder.getPath());
final Runtime r = Runtime.getRuntime();
final Process p = r.exec(command, null, folder);
logger.debug("process started");
final int returnCode = p.waitFor();
if (logger.isWarnEnabled()) {
final BufferedReader is = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = is.readLine()) != null) {
logger.warn(line);
}
final BufferedReader is2 = new BufferedReader(new InputStreamReader(p.getErrorStream()));
while ((line = is2.readLine()) != null) {
logger.warn(line);
}
}
logger.info("File {} unzipped [code = {}]", zipFile, returnCode);
return returnCode;
} catch (final InterruptedException e) {
logger.error("Error", e);
return -1;
}
}
This option much faster and don't require a lot of memory.
Sure, this method platform depended, but works on all(almost all) Unix systems.
P.S. actually most code its just logging :).