Class SizedInts

java.lang.Object
org.apache.cassandra.io.util.SizedInts

public class SizedInts extends Object
Utility class for sizing, writing and reading ints with length stored separately. Used for trie payloads.
  • Constructor Details

    • SizedInts

      public SizedInts()
  • Method Details

    • nonZeroSize

      public static int nonZeroSize(long value)
      Returns the number of bytes we need to store the given position. This method understands 0 to need 1 byte.

      If your use case permits 0 to be encoded in 0 length, use sizeAllowingZero(long) below.

    • sizeAllowingZero

      public static int sizeAllowingZero(long value)
      Returns the number of bytes we need to store the given position. Returns 0 for 0 argument.
    • read

      public static long read(ByteBuffer src, int startPos, int bytes)
    • readUnsigned

      public static long readUnsigned(ByteBuffer src, int startPos, int bytes)
    • write

      public static void write(DataOutputPlus dest, long value, int size) throws IOException
      Throws:
      IOException