Class CompressArithmetic


public class CompressArithmetic
extends java.lang.Object

Mark Nelson
March 8, 1996
**** moded by David Scott in May of 2001 to make bijective
Ported to Java by Tim Tyler, July 2001 -


This program performs an order-0 adaptive arithmetic encoding
function on an input file/stream, and sends the result to an
output file or stream.

This program contains the source code from the 1987 CACM article by Witten, Neal, and Cleary. I have taken the source modules and combined them into this single file for ease of distribution and compilation. Other than that, the code is essentially unchanged.

This program takes two arguments: an input file and an output file. You can leave off one argument and send your output to stdout. Leave off two arguments and read your input from stdin as well.

This program accompanies my article "Data Compression with the Burrows-Wheeler Transform."

Build Instructions

Define the constant unix for UNIX or UNIX-like systems. The use of this constant turns off the code used to force the MS-DOS file system into binary mode. g++ already does this, and your UNIX C++ compiler might also.

Borland C++ 4.5 16 bit : bcc -w ari.cpp
Borland C++ 4.5 32 bit : bcc32 -w ari.cpp
Microsoft Visual C++ 1.52 : cl /W4 ari.cpp
Microsoft Visual C++ 2.1 : cl /W4 ari.cpp
g++ : g++ -o ari ari.cpp

Typical Use

rle < raw-file | bwt | mtf | rle | ari > compressed-file

Constructor Summary
Method Summary
 void compress(java.lang.String input_file, java.lang.String output_file)
          Compresses input_file and store the results in output_file
static void main(java.lang.String[] args)
          Handles the Commmand-line interface to the compressor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public CompressArithmetic()
Method Detail


public void compress(java.lang.String input_file,
                     java.lang.String output_file)
Compresses input_file and store the results in output_file


public static void main(java.lang.String[] args)
Handles the Commmand-line interface to the compressor