Package org.apache.cassandra.io.util
Class SizedInts
java.lang.Object
org.apache.cassandra.io.util.SizedInts
Utility class for sizing, writing and reading ints with length stored separately.
Used for trie payloads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intnonZeroSize(long value) Returns the number of bytes we need to store the given position.static longread(ByteBuffer src, int startPos, int bytes) static longreadUnsigned(ByteBuffer src, int startPos, int bytes) static intsizeAllowingZero(long value) Returns the number of bytes we need to store the given position.static voidwrite(DataOutputPlus dest, long value, int size)
-
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
-
readUnsigned
-
write
- Throws:
IOException
-