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.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
Method Summary |
int |
get(int index,
long[] arr,
int off,
int len)
Bulk get: read at least one and at most len longs starting
from index into arr[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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PackedInts.Reader
public PackedInts.Reader()
get
public int get(int index,
long[] arr,
int off,
int len)
- Bulk get: read at least one and at most
len
longs starting
from index
into arr[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()
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.