Package org.apache.lucene.util.packed
Class PackedInts.Reader
- java.lang.Object
-
- org.apache.lucene.index.NumericDocValues
-
- org.apache.lucene.util.packed.PackedInts.Reader
-
- Direct Known Subclasses:
PackedInts.Mutable
,PackedInts.NullReader
- Enclosing class:
- PackedInts
public abstract static class PackedInts.Reader extends NumericDocValues
A read-only random access array of positive integers.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.index.NumericDocValues
EMPTY
-
-
Constructor Summary
Constructors Constructor Description Reader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
get(int index, long[] arr, int off, int len)
Bulk get: read at least one and at mostlen
longs starting fromindex
intoarr[off:off+len]
and return the actual number of values that have been read.Object
getArray()
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.abstract int
getBitsPerValue()
boolean
hasArray()
Returns true if this implementation is backed by a native java array.abstract long
ramBytesUsed()
Return the in-memory size in bytes.abstract int
size()
-
Methods inherited from class org.apache.lucene.index.NumericDocValues
get
-
-
-
-
Method Detail
-
get
public int get(int index, long[] arr, int off, int len)
Bulk get: read at least one and at mostlen
longs starting fromindex
intoarr[off:off+len]
and return the actual number of values that have been read.
-
getBitsPerValue
public abstract int getBitsPerValue()
- 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 abstract int size()
- Returns:
- the number of values.
-
ramBytesUsed
public abstract long ramBytesUsed()
Return the in-memory size in bytes.
-
getArray
public Object getArray()
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.
-
hasArray
public boolean hasArray()
Returns true if this implementation is backed by a native java array.- See Also:
getArray()
-
-