Class Huffman
- java.lang.Object
-
- jdk.incubator.http.internal.hpack.Huffman
-
public final class Huffman extends java.lang.Object
Huffman coding table.Instances of this class are safe for use by multiple threads.
- Since:
- 9
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
lengthOf(java.lang.CharSequence value)
Calculates the number of bytes required to represent the givenCharSequence
with the Huffman coding.int
lengthOf(java.lang.CharSequence value, int start, int end)
Calculates the number of bytes required to represent a subsequence of the givenCharSequence
with the Huffman coding.
-
-
-
Field Detail
-
INSTANCE
public static final Huffman INSTANCE
Shared instance.
-
-
Method Detail
-
lengthOf
public int lengthOf(java.lang.CharSequence value)
Calculates the number of bytes required to represent the givenCharSequence
with the Huffman coding.- Parameters:
value
- characters- Returns:
- number of bytes
- Throws:
java.lang.NullPointerException
- if the value is null
-
lengthOf
public int lengthOf(java.lang.CharSequence value, int start, int end)
Calculates the number of bytes required to represent a subsequence of the givenCharSequence
with the Huffman coding.- Parameters:
value
- charactersstart
- the start index, inclusiveend
- the end index, exclusive- Returns:
- number of bytes
- Throws:
java.lang.NullPointerException
- if the value is nulljava.lang.IndexOutOfBoundsException
- if any invocation ofvalue.charAt(i)
, wherestart <= i < end
would throw an IndexOutOfBoundsException
-
-