Class ByteSource.VariableLengthUnsignedInteger

java.lang.Object
org.apache.cassandra.utils.bytecomparable.ByteSource.VariableLengthUnsignedInteger
All Implemented Interfaces:
ByteSource
Enclosing interface:
ByteSource

public static class ByteSource.VariableLengthUnsignedInteger extends Object implements ByteSource
Variable-length encoding for unsigned integers. The encoding is similar to UTF-8 encoding. Numbers between 0 and 127 are encoded in one byte, using 0 in the most significant bit. Larger values have 1s in as many of the most significant bits as the number of additional bytes in the representation, followed by a 0. This ensures that longer numbers compare larger than shorter ones. Since we never use a longer representation than necessary, this implies numbers compare correctly. As the number of bytes is specified in the bits of the first, no value is a prefix of another.
  • Constructor Details

    • VariableLengthUnsignedInteger

      public VariableLengthUnsignedInteger(long value)
  • Method Details

    • next

      public int next()
      Description copied from interface: ByteSource
      Consume the next byte, unsigned. Must be between 0 and 255, or END_OF_STREAM if there are no more bytes.
      Specified by:
      next in interface ByteSource