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'sHuffmanParamsas a list of HuffmanBitCodes.intgetCodeWordLenForValue(T value) final Tread(BitInputStream bitInputStream) Read a single huffman-encoded symbol from a streamfinal longwrite(BitOutputStream bitOutputStream, T symbol)
-
Constructor Details
-
HuffmanCanoncialCodeGenerator
- Parameters:
huffmanParams-HuffmanParamsto use for this helper
-
-
Method Details
-
getCanonicalCodeWords
Return the canonical code words for this helper'sHuffmanParamsas 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
-