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

public Class NBitIntegerDecoder

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer

Used to decode integers as described in RFC7541.

Field Summary

Modifier and TypeField and Description
private long
private int
private boolean
private long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the decoded integer or -1 to indicate that more data is needed.
decodeInt
(ByteBuffer
the buffer containing the encoded integer.
buffer
)

Decode an integer from the buffer.

public long

Returns:

the decoded long or -1 to indicate that more data is needed.
decodeLong
(ByteBuffer
the buffer containing the encoded integer.
buffer
)

Decode a long from the buffer.

public void
reset()

Reset the internal state of the parser.

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

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_multiplierback to summary
private long _multiplier
_prefixback to summary
private int _prefix
_startedback to summary
private boolean _started
_totalback to summary
private long _total

Constructor Detail

NBitIntegerDecoderback to summary
public NBitIntegerDecoder()

Method Detail

decodeIntback to summary
public int decodeInt(ByteBuffer buffer)

Decode an integer from the buffer. If the buffer does not contain the complete integer representation a value of -1 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 integer.

Returns:int

the decoded integer or -1 to indicate that more data is needed.

Exceptions
ArithmeticException:
if the value overflows a int.
decodeLongback to summary
public long decodeLong(ByteBuffer buffer)

Decode a long from the buffer. If the buffer does not contain the complete integer representation a value of -1 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 integer.

Returns:long

the decoded long or -1 to indicate that more data is needed.

Exceptions
ArithmeticException:
if the value overflows a long.
resetback to summary
public void reset()

Reset the internal state of the parser.

setPrefixback to summary
public void setPrefix(int prefix)

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

Parameters
prefix:int

the number of bits in the integer prefix.