Class VariableLengthEncoding

java.lang.Object
kieker.common.util.dataformat.VariableLengthEncoding

public final class VariableLengthEncoding
extends java.lang.Object
Utility functions for variable-length encoding of integers.
Since:
1.13
Author:
Holger Knoche
  • Method Summary

    Modifier and Type Method Description
    static int decodeInt​(java.nio.ByteBuffer buffer)
    Decodes a variable-length integer value stored at the current position in the byte buffer.
    static void encodeInt​(int value, java.nio.ByteBuffer buffer)
    Encodes a given int value using a variable-length encoding.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • encodeInt

      public static void encodeInt​(int value, java.nio.ByteBuffer buffer)
      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 encode
      buffer - The buffer to write the data to
    • decodeInt

      public static int decodeInt​(java.nio.ByteBuffer buffer)
      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