Class HuffmanCanoncialCodeGenerator<T>
java.lang.Object
htsjdk.samtools.cram.encoding.core.huffmanUtils.HuffmanCanoncialCodeGenerator<T>
- Type Parameters:
T
- type of the symbols in the alphabet being huffman-encoded
Given a set of
HuffmanParams
, creates the set of canonical codes that are be used to
read/write symbols from/to an output/input stream.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the canonical code words for this helper'sHuffmanParams
as a list of HuffmanBitCodes.int
getCodeWordLenForValue
(T value) final T
read
(BitInputStream bitInputStream) Read a single huffman-encoded symbol from a streamfinal long
write
(BitOutputStream bitOutputStream, T symbol)
-
Constructor Details
-
HuffmanCanoncialCodeGenerator
- Parameters:
huffmanParams
-HuffmanParams
to use for this helper
-
-
Method Details
-
getCanonicalCodeWords
Return the canonical code words for this helper'sHuffmanParams
as a list of HuffmanBitCodes.- Returns:
- list of HuffmanBitCode for this helper's
HuffmanParams
-
write
- Parameters:
bitOutputStream
- stream to which the symbol should be writtensymbol
- symbol from the alphabet to be written to the stream- Returns:
- the length of the codeword that was written
-
read
Read a single huffman-encoded symbol from a stream- Parameters:
bitInputStream
- stream from which a symbol should read- Returns:
- symbol read from the stream
-
getCodeWordLenForValue
-