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

public Class NBitStringDecoder

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, org.eclipse.jetty.util.CharsetStringBuilder

Used to decode string literals as described in RFC7541.

The string literal representation consists of a single bit to indicate whether huffman encoding is used, followed by the string byte length encoded with the n-bit integer representation also from RFC7541, and the bytes of the string are directly after this.

Characters which are illegal field-vchar values are replaced with either ' ' or '?' as described in RFC9110

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final CharsetStringBuilder.Iso88591StringBuilder
private int
private boolean
private final HuffmanDecoder
private final NBitIntegerDecoder
private int
private int
private NBitStringDecoder.State

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the decoded string or null to indicate that more data is needed.
decode
(ByteBuffer
the buffer containing the encoded string.
buffer
)

Decode a string from the buffer.

public void
public void
setPrefix(int
the number of bits in the string prefix.
prefix
)

Set the prefix length in of the string representation in bits.

private String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_builderback to summary
private final CharsetStringBuilder.Iso88591StringBuilder _builder
_countback to summary
private int _count
_huffmanback to summary
private boolean _huffman
_huffmanBuilderback to summary
private final HuffmanDecoder _huffmanBuilder
_integerDecoderback to summary
private final NBitIntegerDecoder _integerDecoder
_lengthback to summary
private int _length
_prefixback to summary
private int _prefix
_stateback to summary
private NBitStringDecoder.State _state

Constructor Detail

NBitStringDecoderback to summary
public NBitStringDecoder()

Method Detail

decodeback to summary
public String decode(ByteBuffer buffer) throws EncodingException

Decode a string from the buffer. If the buffer does not contain the complete string representation then a value of null is returned to indicate that more data is needed to complete parsing. This should be only after the prefix has been set with setPrefix(int).

Parameters
buffer:ByteBuffer

the buffer containing the encoded string.

Returns:String

the decoded string or null to indicate that more data is needed.

Exceptions
EncodingException:
if the string encoding is invalid.
ArithmeticException:
if the string length value overflows a int.
resetback to summary
public void reset()
setPrefixback to summary
public void setPrefix(int prefix)

Set the prefix length in of the string representation in bits. A prefix of 6 means the string representation starts after the first 2 bits.

Parameters
prefix:int

the number of bits in the string prefix.

stringDecodeback to summary
private String stringDecode(ByteBuffer buffer)
org.eclipse.jetty.http.compression back to summary

private final Enum NBitStringDecoder.State

extends Enum<NBitStringDecoder.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final NBitStringDecoder.State
public static final NBitStringDecoder.State
public static final NBitStringDecoder.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static NBitStringDecoder.State
public static NBitStringDecoder.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

LENGTHback to summary
public static final NBitStringDecoder.State LENGTH
PARSINGback to summary
public static final NBitStringDecoder.State PARSING
VALUEback to summary
public static final NBitStringDecoder.State VALUE

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static NBitStringDecoder.State valueOf(String name)
valuesback to summary
public static NBitStringDecoder.State[] values()