Package org.apache.lucene.util.packed
Class AppendingPackedLongBuffer
java.lang.Object
org.apache.lucene.index.NumericDocValues
org.apache.lucene.util.LongValues
org.apache.lucene.util.packed.AppendingPackedLongBuffer
Utility class to buffer a list of signed longs in memory. This class only
 supports appending and is optimized for non-negative numbers with a uniform distribution over a fixed (limited) range
- 
Field SummaryFields inherited from class org.apache.lucene.index.NumericDocValuesEMPTY
- 
Constructor SummaryConstructorsConstructorDescriptionCreate anAppendingPackedLongBufferwith initialPageCount=16, pageSize=1024 and acceptableOverheadRatio=PackedInts.DEFAULTAppendingPackedLongBuffer(float acceptableOverheadRatio) Create anAppendingPackedLongBufferwith initialPageCount=16, pageSize=1024AppendingPackedLongBuffer(int initialPageCount, int pageSize, float acceptableOverheadRatio) 
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidadd(long l) Append a value to this buffer.voidfreeze()Pack all pending values in this buffer.final longget(long index) Get value atindex.final intget(long index, long[] arr, int off, int len) Bulk get: read at least one and at mostlenlongs starting fromindexintoarr[off:off+len]and return the actual number of values that have been read.org.apache.lucene.util.packed.AbstractAppendingLongBuffer.Iteratoriterator()Return an iterator over the values of this buffer.longReturn the number of bytes used by this instance.final longsize()Get the number of values that have been added to the buffer.Methods inherited from class org.apache.lucene.util.LongValuesget
- 
Constructor Details- 
AppendingPackedLongBufferpublic AppendingPackedLongBuffer(int initialPageCount, int pageSize, float acceptableOverheadRatio) - Parameters:
- initialPageCount- the initial number of pages
- pageSize- the size of a single page
- acceptableOverheadRatio- an acceptable overhead ratio per value
 
- 
AppendingPackedLongBufferpublic AppendingPackedLongBuffer()Create anAppendingPackedLongBufferwith initialPageCount=16, pageSize=1024 and acceptableOverheadRatio=PackedInts.DEFAULT
- 
AppendingPackedLongBufferpublic AppendingPackedLongBuffer(float acceptableOverheadRatio) Create anAppendingPackedLongBufferwith initialPageCount=16, pageSize=1024
 
- 
- 
Method Details- 
sizepublic final long size()Get the number of values that have been added to the buffer.
- 
addpublic final void add(long l) Append a value to this buffer.
- 
getpublic final long get(long index) Description copied from class:LongValuesGet value atindex.- Specified by:
- getin class- LongValues
 
- 
getpublic final int get(long index, long[] arr, int off, int len) Bulk get: read at least one and at mostlenlongs starting fromindexintoarr[off:off+len]and return the actual number of values that have been read.
- 
iteratorpublic org.apache.lucene.util.packed.AbstractAppendingLongBuffer.Iterator iterator()Return an iterator over the values of this buffer.
- 
ramBytesUsedpublic long ramBytesUsed()Return the number of bytes used by this instance.
- 
freezepublic void freeze()Pack all pending values in this buffer. Subsequent calls toadd(long)will fail.
 
-