Question

I need to store abitrary binary data (essentially files of various common formats, JPEG, PDF, MS-Office and some other odd files). Slow compression is not a problem, but I'm looking for reasonably fast decompression and as good a compression ratio as I can get.

For now my system immediately stores the data uncompressed and a daemon attempts to compress the data later, for now the only option I have implemented is using GZIP. If the file can be compressed it is transparently replaced with a compressed version by the daemon (thats why slow compression does not bother me at all). If there were more options I would be quite happy to let the daemon try all the choices and go with the one that yields the best compression.

To keep the system simple, I don't want to go through great lengths to integrate stuff that does not support use through the Stream API (like 7-Zip LZMA). Are there any compression implementations beside the GZIP one provided by the JRE that might be useful? FOS preferred.

Was it helpful?

Solution 3

Another LZMA implementation in pure Java: XZ for Java (includes LZMA).

OTHER TIPS

You could giva a try to the bzip lib. bzip usually has better compression ratios at speed expense. Some implementations below:

http://www.kohsuke.org/bzip2//

http://code.google.com/p/jbzip2/

http://www.java2s.com/Code/Java/File-Input-Output/BZip2format.htm

There is also an implementation of bzip on the apache commons compress lib:

http://commons.apache.org/compress/

You can try to use LZMA. It looks like someone implmeneted usage with streams here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top