Interface Codec

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Codec.Binary
      A binary fixed-width codec.
      static interface  Codec.Coder
      A coder: provides methods to turn symbols into codewords.
      static interface  Codec.Decoder
      A decoder: provides a method to turn sequences of bits into symbols.
      static class  Codec.Gamma
      A codec based on Elias's γ code (starting at zero).
      static class  Codec.Huffman
      A Huffman codec with length-limiting capabilities and a fast canonical decoder.
      static class  Codec.Unary
      A unary codec (starting at zero).
      static class  Codec.ZeroCodec
      A degenerate stateless codec (always returns zero).
    • Method Summary

      Modifier and Type Method Description
      Codec.Coder getCoder​(Long2LongMap frequencies)
      Returns a coder for a specific map from symbols to frequencies.
    • Method Detail

      • getCoder

        Codec.Coder getCoder​(Long2LongMap frequencies)
        Returns a coder for a specific map from symbols to frequencies.

        Note that even instantaneous codes (such as Codec.Unary) need to know the set of symbols, as the returned coder needs to known the maximum codeword length.

        Parameters:
        frequencies - a map from symbols (longs) to frequencies (longs).
        Returns:
        a coder for the given map.