Class Huffman

java.lang.Object
org.glassfish.grizzly.http2.hpack.Huffman

public final class Huffman extends Object
Huffman coding table.

Instances of this class are safe for use by multiple threads.

  • Field Details

    • INSTANCE

      public static final Huffman INSTANCE
      Shared instance.
  • Method Details

    • lengthOf

      public int lengthOf(CharSequence value)
      Calculates the number of bytes required to represent the given CharSequence with the Huffman coding.
      Parameters:
      value - characters
      Returns:
      number of bytes
      Throws:
      NullPointerException - if the value is null
    • lengthOf

      public int lengthOf(CharSequence value, int start, int end)
      Calculates the number of bytes required to represent a sub-sequence of the given CharSequence with the Huffman coding.
      Parameters:
      value - characters
      start - the start index, inclusive
      end - the end index, exclusive
      Returns:
      number of bytes
      Throws:
      NullPointerException - if the value is null
      IndexOutOfBoundsException - if any invocation of value.charAt(i), where start <= i < end would throw an IndexOutOfBoundsException