Class PrefixedIntegerCodec
java.lang.Object
io.helidon.common.buffers.PrefixedIntegerCodec
Shared codec for HPACK/QPACK prefixed integers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intreadInt(BufferData source, int firstByte, int prefixBits) Read a prefixed integer into anint.static longreadLong(BufferData source, int firstByte, int prefixBits) Read a prefixed integer into along.static BufferDatawriteInt(BufferData target, int value, int leadingBits, int prefixBits) Write anintprefixed integer.static BufferDatawriteLong(BufferData target, long value, int leadingBits, int prefixBits) Write alongprefixed integer.
-
Method Details
-
readInt
Read a prefixed integer into anint.- Parameters:
source- source buffer positioned after the first bytefirstByte- first byte of the encoded integerprefixBits- number of bits in the first byte reserved for the value, between1and8- Returns:
- decoded integer value
- Throws:
IllegalArgumentException- if the prefix width is outside the supported range
-
readLong
Read a prefixed integer into along.- Parameters:
source- source buffer positioned after the first bytefirstByte- first byte of the encoded integerprefixBits- number of bits in the first byte reserved for the value, between1and8- Returns:
- decoded integer value
- Throws:
IllegalArgumentException- if the prefix width is outside the supported range
-
writeInt
Write anintprefixed integer.- Parameters:
target- target buffervalue- full non-negative value to writeleadingBits- bits stored in the first byte outside of the value prefixprefixBits- number of bits in the first byte reserved for the value, between1and8- Returns:
- target buffer
- Throws:
IllegalArgumentException- if the value or prefix width is outside the supported range
-
writeLong
Write alongprefixed integer.- Parameters:
target- target buffervalue- full non-negative value to writeleadingBits- bits stored in the first byte outside of the value prefixprefixBits- number of bits in the first byte reserved for the value, between1and8- Returns:
- target buffer
- Throws:
IllegalArgumentException- if the value or prefix width is outside the supported range
-