T - type of the symbols in the alphabet being huffman-encodedpublic final class HuffmanCanoncialCodeGenerator<T>
extends java.lang.Object
HuffmanParams, creates the set of canonical codes that are be used to
read/write symbols from/to an output/input stream.| Constructor and Description |
|---|
HuffmanCanoncialCodeGenerator(HuffmanParams<T> huffmanParams) |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<HuffmanBitCode<T>> |
getCanonicalCodeWords()
Return the canonical code words for this helper's
HuffmanParams as a list of HuffmanBitCodes. |
int |
getCodeWordLenForValue(T value) |
T |
read(BitInputStream bitInputStream)
Read a single huffman-encoded symbol from a stream
|
long |
write(BitOutputStream bitOutputStream,
T symbol) |
public HuffmanCanoncialCodeGenerator(HuffmanParams<T> huffmanParams)
huffmanParams - HuffmanParams to use for this helperpublic java.util.List<HuffmanBitCode<T>> getCanonicalCodeWords()
HuffmanParams as a list of HuffmanBitCodes.HuffmanParamspublic final long write(BitOutputStream bitOutputStream, T symbol)
bitOutputStream - stream to which the symbol should be writtensymbol - symbol from the alphabet to be written to the streampublic final T read(BitInputStream bitInputStream)
bitInputStream - stream from which a symbol should readpublic int getCodeWordLenForValue(T value)