Top Description Constructors Methods
org.eclipse.jetty.http.compression

public Class HuffmanEncoder

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, org.eclipse.jetty.http.HttpTokens

Used to encode strings Huffman encoding.

Characters are encoded with ISO-8859-1, if any multi-byte characters or control characters are present the encoder will throw EncodingException.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
encode(ByteBuffer
the buffer to encode into.
buffer
,
String
the string to encode.
s
)

private static void
encode(final int[][]
The table to encode by
table
,
ByteBuffer
The buffer to encode to
buffer
,
String
The string to encode
s
)

public static void
encodeLowerCase(ByteBuffer
the buffer to encode into in lowercase.
buffer
,
String
the string to encode.
s
)

public static int

Returns:

the number of octets needed to encode the string, or -1 if it cannot be encoded.
octetsNeeded
(String
the string to encode.
s
)

public static int

Returns:

the number of octets needed to encode the bytes, or -1 if it cannot be encoded.
octetsNeeded
(byte[]
the byte array to encode.
b
)

private static int
octetsNeeded(final int[][] table, String s)

public static int

Returns:

the number of octets needed to encode the string, or -1 if it cannot be encoded.
octetsNeededLowerCase
(String
the string to encode in lowercase.
s
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HuffmanEncoderback to summary
private HuffmanEncoder()

Method Detail

encodeback to summary
public static void encode(ByteBuffer buffer, String s)
Parameters
buffer:ByteBuffer

the buffer to encode into.

s:String

the string to encode.

encodeback to summary
private static void encode(final int[][] table, ByteBuffer buffer, String s)
Parameters
table:int[][]

The table to encode by

buffer:ByteBuffer

The buffer to encode to

s:String

The string to encode

encodeLowerCaseback to summary
public static void encodeLowerCase(ByteBuffer buffer, String s)
Parameters
buffer:ByteBuffer

the buffer to encode into in lowercase.

s:String

the string to encode.

octetsNeededback to summary
public static int octetsNeeded(String s)
Parameters
s:String

the string to encode.

Returns:int

the number of octets needed to encode the string, or -1 if it cannot be encoded.

octetsNeededback to summary
public static int octetsNeeded(byte[] b)
Parameters
b:byte[]

the byte array to encode.

Returns:int

the number of octets needed to encode the bytes, or -1 if it cannot be encoded.

octetsNeededback to summary
private static int octetsNeeded(final int[][] table, String s)
octetsNeededLowerCaseback to summary
public static int octetsNeededLowerCase(String s)
Parameters
s:String

the string to encode in lowercase.

Returns:int

the number of octets needed to encode the string, or -1 if it cannot be encoded.