Package it.unimi.dsi.sux4j.mph.codec
Class Codec.Huffman.Coder.Decoder
- java.lang.Object
-
- it.unimi.dsi.sux4j.mph.codec.Codec.Huffman.Coder.Decoder
-
- All Implemented Interfaces:
Codec.Decoder,java.io.Serializable
- Enclosing class:
- Codec.Huffman.Coder
public static final class Codec.Huffman.Coder.Decoder extends java.lang.Object implements Codec.Decoder
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Decoder(long[] lastCodeWordPlusOne, int[] howManyUpToBlock, byte[] shift, int escapeLength, int escapedSymbolLength, long[] symbol)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longdecode(long value)Decodes a sequence of bits.voiddump(java.nio.ByteBuffer buffer)intescapedSymbolLength()Returns the length in bit of an escaped symbol, or zero if there are no escaped symbols.intescapeLength()Returns the length of the escape codeword, if it exists, or zero.longnumBits()The number of bits used by this decoder.
-
-
-
Method Detail
-
escapedSymbolLength
public int escapedSymbolLength()
Description copied from interface:Codec.DecoderReturns the length in bit of an escaped symbol, or zero if there are no escaped symbols.- Specified by:
escapedSymbolLengthin interfaceCodec.Decoder- Returns:
- the length in bit of an escaped symbol, or zero if there are no escaped symbols.
-
escapeLength
public int escapeLength()
Description copied from interface:Codec.DecoderReturns the length of the escape codeword, if it exists, or zero.- Specified by:
escapeLengthin interfaceCodec.Decoder- Returns:
- the escape codeword, if it exists, or zero.
-
decode
public long decode(long value)
Description copied from interface:Codec.DecoderDecodes a sequence of bits.If the first codeword appearing in the sequence is the escape codeword, this method returns −1 and the actual symbol must be retrieved by reading
Codec.Decoder.escapedSymbolLength()further bits.This method assumes that the first bit of the code is the leftmost bit (i.e., the bit of index
Codec.Coder.maxCodewordLength()− 1).- Specified by:
decodein interfaceCodec.Decoder- Parameters:
value- a sequence of bits.- Returns:
- the symbol associated with the first codeword appearing in the sequence, or −1 if the codeword is an escape.
-
numBits
public long numBits()
Description copied from interface:Codec.DecoderThe number of bits used by this decoder.- Specified by:
numBitsin interfaceCodec.Decoder- Returns:
- the number of bits used by this decoder.
-
dump
public void dump(java.nio.ByteBuffer buffer)
-
-