Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.http2.hpack

public final Class Huffman

extends Object
Class Inheritance
Static Imports
java.lang.String.format

Huffman coding table.

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Huffman.Code[]
private final Huffman.Code
public static final Huffman
INSTANCE

Shared instance.

private final Huffman.Node

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
addChar(int c, int code, int bitLength)

private void
addEOS(int c, int code, int bitLength)

private void
addLeaf(int c, int code, int bitLength, boolean isEOS)

private Huffman.Code
codeOf(char c)

pack-priv Huffman.Node
public int

Returns:

number of bytes
lengthOf
(CharSequence
characters
value
)

Calculates the number of bytes required to represent the given CharSequence with the Huffman coding.

public int

Returns:

number of bytes
lengthOf
(CharSequence
characters
value
,
int
the start index, inclusive
start
,
int
the end index, exclusive
end
)

Calculates the number of bytes required to represent a sub-sequence of the given CharSequence with the Huffman coding.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

codesback to summary
private final Huffman.Code[] codes
EOSback to summary
private final Huffman.Code EOS
INSTANCEback to summary
public static final Huffman INSTANCE

Shared instance.

rootback to summary
private final Huffman.Node root

Constructor Detail

Huffmanback to summary
private Huffman()

Method Detail

addCharback to summary
private void addChar(int c, int code, int bitLength)
addEOSback to summary
private void addEOS(int c, int code, int bitLength)
addLeafback to summary
private void addLeaf(int c, int code, int bitLength, boolean isEOS)
codeOfback to summary
private Huffman.Code codeOf(char c)
getRootback to summary
pack-priv Huffman.Node getRoot()
Annotations
@SuppressWarnings:unused
lengthOfback to summary
public int lengthOf(CharSequence value)

Calculates the number of bytes required to represent the given CharSequence with the Huffman coding.

Parameters
value:CharSequence

characters

Returns:int

number of bytes

Annotations
@SuppressWarnings:unused
Exceptions
NullPointerException:
if the value is null
lengthOfback to summary
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:CharSequence

characters

start:int

the start index, inclusive

end:int

the end index, exclusive

Returns:int

number of bytes

Exceptions
NullPointerException:
if the value is null
IndexOutOfBoundsException:
if any invocation of value.charAt(i), where start <= i < end would throw an IndexOutOfBoundsException
org.glassfish.grizzly.http2.hpack back to summary

private final Class Huffman.Code

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final int

Constructor Summary

AccessConstructor and Description
private
Code(int code, int length)

Method Summary

Modifier and TypeMethod and Description
public int
public int
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

codeback to summary
pack-priv final int code
lengthback to summary
pack-priv final int length

Constructor Detail

Codeback to summary
private Code(int code, int length)

Method Detail

getCodeback to summary
public int getCode()
getLengthback to summary
public int getLength()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.glassfish.grizzly.http2.hpack back to summary

pack-priv Class Huffman.Node

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv char
c

pack-priv boolean
pack-priv boolean
pack-priv Huffman.Node
pack-priv Huffman.Node

Constructor Summary

AccessConstructor and Description
pack-priv
Node()

Method Summary

Modifier and TypeMethod and Description
pack-priv Huffman.Node
pack-priv char
pack-priv Huffman.Node
getChild(int selector)

pack-priv boolean
pack-priv void
setChar(char c)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cback to summary
pack-priv char c
charIsSetback to summary
pack-priv boolean charIsSet
isEOSPathback to summary
pack-priv boolean isEOSPath
leftback to summary
pack-priv Huffman.Node left
rightback to summary
pack-priv Huffman.Node right

Constructor Detail

Nodeback to summary
pack-priv Node()

Method Detail

addChildIfAbsentback to summary
pack-priv Huffman.Node addChildIfAbsent(int i)
getCharback to summary
pack-priv char getChar()
getChildback to summary
pack-priv Huffman.Node getChild(int selector)
isLeafback to summary
pack-priv boolean isLeaf()
setCharback to summary
pack-priv void setChar(char c)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
org.glassfish.grizzly.http2.hpack back to summary

pack-priv final Class Huffman.Reader

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Huffman.Node
private int
private int
p

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
read(Buffer source, Appendable destination, boolean isLast)

pack-priv void
read(Buffer source, Appendable destination, boolean reportEOS, boolean isLast)

public void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currback to summary
private Huffman.Node curr
lenback to summary
private int len
pback to summary
private int p

Constructor Detail

Readerback to summary
pack-priv Reader()

Method Detail

readback to summary
public void read(Buffer source, Appendable destination, boolean isLast)
readback to summary
pack-priv void read(Buffer source, Appendable destination, boolean reportEOS, boolean isLast)
resetback to summary
public void reset()
resetProbeback to summary
private void resetProbe()
org.glassfish.grizzly.http2.hpack back to summary

pack-priv final Class Huffman.Writer

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private int
private int
private int
private int
private int
private CharSequence

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Huffman.Writer
from(CharSequence input, int start, int end)

public Huffman.Writer
public boolean
write(Buffer destination)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

availback to summary
private int avail
codeback to summary
private int code
currback to summary
private int curr
endback to summary
private int end
posback to summary
private int pos
remback to summary
private int rem
sourceback to summary
private CharSequence source

Constructor Detail

Writerback to summary
pack-priv Writer()

Method Detail

fromback to summary
public Huffman.Writer from(CharSequence input, int start, int end)
resetback to summary
public Huffman.Writer reset()
writeback to summary
public boolean write(Buffer destination)