Java 8 Huffman coding implementation
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
src
.gitignore
.travis.yml
LICENSE
README.md
pom.xml

README.md

Java 8 Huffman Coding Implementation

Build Status Coverage Status License

Toy project implementing a Huffman Encoder using Java 8 and Dagger 2.

I created it as an exercise in using Java 8 constructs, which you can see most prominently in the Encoder and FrequencyDistribution classes.

The project uses Dagger 2 to manage some very basic dependencies. All of the Dagger 2 dependencies are in maven, but if you want to run the code in eclipse (or another IDE) you'll need to set up annotation processing (as seen here, and create a target/generated-sources/annotations source directory.

Running the Encoder

The HuffmanEncoder class should be called to encode a message. The result of the encode() call is a EncodingResult object which contains both the encoded result and the encoding tree required to decode the message again.

Structure

The encoder stores the result of encoding each character in a BitSet which is is converted into a byte array before being stored into EncodingResult.