Class Codec.Gamma.Coder.Decoder

java.lang.Object
it.unimi.dsi.sux4j.mph.codec.Codec.Gamma.Coder.Decoder
All Implemented Interfaces:
Codec.Decoder, Serializable
Enclosing class:
Codec.Gamma.Coder

protected static final class Codec.Gamma.Coder.Decoder extends Object implements Codec.Decoder
See Also:
  • Constructor Details

    • Decoder

      public Decoder(int maxCodewordLength)
  • Method Details

    • decode

      public long decode(long code)
      Description copied from interface: Codec.Decoder
      Decodes 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:
      decode in interface Codec.Decoder
      Parameters:
      code - 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.Decoder
      The number of bits used by this decoder.
      Specified by:
      numBits in interface Codec.Decoder
      Returns:
      the number of bits used by this decoder.