Class PinotDataBitSet
- java.lang.Object
-
- org.apache.pinot.segment.local.io.util.PinotDataBitSet
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class PinotDataBitSet extends Object implements Closeable
-
-
Constructor Summary
Constructors Constructor Description PinotDataBitSet(PinotDataBuffer dataBuffer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intgetNextNthSetBitOffset(int bitOffset, int n)intgetNextSetBitOffset(int bitOffset)static intgetNumBitsPerValue(int maxValue)Returns the number of bits required to encode the value.intreadInt(int index, int numBitsPerValue)voidreadInt(int startIndex, int numBitsPerValue, int length, int[] buffer)voidsetBit(int bitOffset)voidunsetBit(int bitOffset)voidwriteInt(int index, int numBitsPerValue, int value)voidwriteInt(int startIndex, int numBitsPerValue, int length, int[] values)
-
-
-
Constructor Detail
-
PinotDataBitSet
public PinotDataBitSet(PinotDataBuffer dataBuffer)
-
-
Method Detail
-
getNumBitsPerValue
public static int getNumBitsPerValue(int maxValue)
Returns the number of bits required to encode the value.NOTE: Use at least one bit even there is only one possible value
Examples: (maximum value (binary format) -> number of bits)
- 0(0) -> 1
- 1(1) -> 1
- 2(10) -> 2
- 9(1001) -> 4
- 113(1110001) -> 7
- Parameters:
maxValue- Maximum possible value- Returns:
- Number of bits required to encode the value
-
readInt
public int readInt(int index, int numBitsPerValue)
-
readInt
public void readInt(int startIndex, int numBitsPerValue, int length, int[] buffer)
-
writeInt
public void writeInt(int index, int numBitsPerValue, int value)
-
writeInt
public void writeInt(int startIndex, int numBitsPerValue, int length, int[] values)
-
setBit
public void setBit(int bitOffset)
-
unsetBit
public void unsetBit(int bitOffset)
-
getNextSetBitOffset
public int getNextSetBitOffset(int bitOffset)
-
getNextNthSetBitOffset
public int getNextNthSetBitOffset(int bitOffset, int n)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-