Class PackedInts.ReaderImpl

  • All Implemented Interfaces:
    PackedInts.Reader
    Enclosing class:
    PackedInts

    public abstract static class PackedInts.ReaderImpl
    extends Object
    implements PackedInts.Reader
    A simple base for Readers that keeps track of valueCount and bitsPerValue.
    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
    • Field Detail

      • bitsPerValue

        protected final int bitsPerValue
      • valueCount

        protected final int valueCount
    • Constructor Detail

      • ReaderImpl

        protected ReaderImpl​(int valueCount,
                             int bitsPerValue)
    • Method Detail

      • getBitsPerValue

        public int getBitsPerValue()
        Specified by:
        getBitsPerValue in interface PackedInts.Reader
        Returns:
        the number of bits used to store any given value. Note: This does not imply that memory usage is bitsPerValue * #values as implementations are free to use non-space-optimal packing of bits.
      • size

        public int size()
        Specified by:
        size in interface PackedInts.Reader
        Returns:
        the number of values.
      • getMaxValue

        public long getMaxValue()
      • getArray

        public Object getArray()
        Description copied from interface: PackedInts.Reader
        Expert: if the bit-width of this reader matches one of java's native types, returns the underlying array (ie, byte[], short[], int[], long[]); else, returns null. Note that when accessing the array you must upgrade the type (bitwise AND with all ones), to interpret the full value as unsigned. Ie, bytes[idx]&0xFF, shorts[idx]&0xFFFF, etc.
        Specified by:
        getArray in interface PackedInts.Reader