bzip2 library from Apache Ant

Apache Ant includes a Java implementation of the bzip2 stream compression algorithm. It takes more resources/time compared to gzip, but it compresses better than gzip.

The code in Ant seems to be the best open-source Java implementation of bzip2 available today, but unfortunately it is not advertised well. So I decided to just rip the portion and repackage it.

Obviously the code is covered by the Apache Software License. The license file is included in the jar file.

Usage

org.apache.tools.bzip2.CBZip2InputStream can be used just like java.util.GZIPInputStream and org.apache.tools.bzip2.CBZip2OutputStream can be used just like java.util.GZIPOutputStream. Things can't be easier than that.

Note

Jacek Bilski told me that he had to read two bytes from the stream before he uses CBZip2InputStream. Those two bytes ('B' and 'Z') are used by the command line bzip program to mark the stream.


Back to home