Package kieker.common.util.dataformat
Class VariableLengthEncoding
java.lang.Object
kieker.common.util.dataformat.VariableLengthEncoding
Utility functions for variable-length encoding of integers.
- Since:
- 1.13
- Author:
- Holger Knoche
-
Method Summary
Modifier and TypeMethodDescriptionstatic intdecodeInt(ByteBuffer buffer) Decodes a variable-length integer value stored at the current position in the byte buffer.static voidencodeInt(int value, ByteBuffer buffer) Encodes a given int value using a variable-length encoding.
-
Method Details
-
encodeInt
Encodes a given int value using a variable-length encoding. Each encoded byte starts with an indicator bit, followed by 7 data bits. The data bits are stored in lsb-first fashion to facilitate the encoding, which is more time-critical.- Parameters:
value- The value to encodebuffer- The buffer to write the data to
-
decodeInt
Decodes a variable-length integer value stored at the current position in the byte buffer.- Parameters:
buffer- The buffer to decode the data from- Returns:
- The decoded integer value
-