Class NBitIntegerDecoder
java.lang.Object
org.eclipse.jetty.http.compression.NBitIntegerDecoder
Used to decode integers as described in RFC7541.
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionintdecodeInt(ByteBuffer buffer) Decode an integer from the buffer.longdecodeLong(ByteBuffer buffer) Decode a long from the buffer.voidreset()Reset the internal state of the parser.voidsetPrefix(int prefix) Set the prefix length in of the integer representation in bits. 
- 
Constructor Details
- 
NBitIntegerDecoder
public NBitIntegerDecoder() 
 - 
 - 
Method Details
- 
setPrefix
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- the number of bits in the integer prefix.
 - 
decodeInt
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 withsetPrefix(int).- Parameters:
 buffer- the buffer containing the encoded integer.- Returns:
 - the decoded integer or -1 to indicate that more data is needed.
 - Throws:
 ArithmeticException- if the value overflows a int.
 - 
decodeLong
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 withsetPrefix(int).- Parameters:
 buffer- the buffer containing the encoded integer.- Returns:
 - the decoded long or -1 to indicate that more data is needed.
 - Throws:
 ArithmeticException- if the value overflows a long.
 - 
reset
public void reset()Reset the internal state of the parser. 
 -