Interface Codec.Decoder

    • Method Summary

      Modifier and Type Method Description
      long decode​(long sequence)
      Decodes a sequence of bits.
      default int escapedSymbolLength()
      Returns the length in bit of an escaped symbol, or zero if there are no escaped symbols.
      default int escapeLength()
      Returns the length of the escape codeword, if it exists, or zero.
      long numBits()
      The number of bits used by this decoder.
    • Method Detail

      • decode

        long decode​(long sequence)
        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 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).

        Parameters:
        sequence - 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

        long numBits()
        The number of bits used by this decoder.
        Returns:
        the number of bits used by this decoder.
      • escapedSymbolLength

        default int escapedSymbolLength()
        Returns the length in bit of an escaped symbol, or zero if there are no escaped symbols.
        Returns:
        the length in bit of an escaped symbol, or zero if there are no escaped symbols.
      • escapeLength

        default int escapeLength()
        Returns the length of the escape codeword, if it exists, or zero.
        Returns:
        the escape codeword, if it exists, or zero.