Java/J2ME Range Encoder compression
Java/J2ME implementation of a Range Encoding compression
Range Encoding is a lossless compression method described by G N N Martin in his 1979 paper on "Range encoding: an algorithm for removing redundancy from a digitized message".
Range coders are used in conjunction with a probabilistic model to create a compression algorithm. The code provided here uses a simple (order 0) model. The compression performance is not stellar, but it's not too shabby either.
This implementation was based on the notes and sample code at: http://www.bodden.de/studies/ac/
Getting the software
Two files are available:- Compressor.java - the implementation itself
- CompressorTest.java - a simple test/demonstration program
Usage
The Compressor class provides two static methods that are simple to use:
byte[] input; ... byte[] compressed = Compressor.compress(input); byte[] decompressed = Compressor.decompress(compressed);
Feedback
Please report bugs to joe.halliwell@gmail.com.
Licence
Although this code is probably too trifiling to argue over, for the avoidance of doubt and encouragement of comments/contributions it is published under the LGPL.