This page is intended to be a quick run-through of the Huffman compression code.
Test.java is the file I used to test the compression and decompression.
The biTree package contains the classes for binary trees, BiTree and Symbol. Each of these implements WeightCompare, which is the binary tree node type in general. A BiTree is a node within the tree that is not a terminating node, or leaf. A Symbol is a leaf. In Huffman encoding, all of the leaves will be letters to encode and all of the letters to encode will be leaves. Symbol has a weight and a value (the letter to be encoded).
This package also contains several visitors on WeightCompares. GetCode and GetCodeHelper are visitors the traverse a tree to find a letter, given a sequence of bits. These are used in the decoder. MakeHashTable makes a hashtable from the binary tree on which it is called. It is used in the encoder to get a hastable of letters and their encoded values.
The compress package contains the compression algorithms, Huff and Arithmetic. Compression algorithm classes are of type CompressAlgo. ReadIn reads in a file, creates a dictionary, and outputs that dictionary to a file. VecToTree creates a tree for Huffman encoding/decoding from a vector of Symbols. BitsToFile writes a vector of bits to the file. This must bet done carefully, since I can only write a byte at a time. I write a byte whenever I have one, and then clear out the vector of bits. Intwrapper is used to pass around Integers by reference instead of by value. ardecode.c is the only C program of the bunch. It is the arithmetic decoder.