Package org.apache.lucene.util.packed
package org.apache.lucene.util.packed
Packed integer arrays and streams.
The packed package provides
- sequential and random access capable arrays of positive longs,
- routines for efficient serialization and deserialization of streams of packed integers.
The main access point is the PackedInts
factory.
In-memory structures
PackedInts.Mutable
- Only supports positive longs.
- Requires the number of bits per value to be known in advance.
- Random-access for both writing and reading.
GrowableWriter
- Same as PackedInts.Mutable but grows the number of bits per values when needed.
- Useful to build a PackedInts.Mutable from a read-once stream of longs.
PagedGrowableWriter
- Slices data into fixed-size blocks stored in GrowableWriters.
- Supports more than 2B values.
- You should use Appending(Delta)PackedLongBuffer instead if you don't need random write access.
AppendingDeltaPackedLongBuffer
- Can store any sequence of longs.
- Compression is good when values are close to each other.
- Supports random reads, but only sequential writes.
- Can address up to 2^42 values.
AppendingPackedLongBuffer
- Same as AppendingDeltaPackedLongBuffer but assumes values are 0-based.
MonotonicAppendingLongBuffer
- Same as AppendingDeltaPackedLongBuffer except that compression is good when the stream is a succession of affine functions.
Disk-based structures
PackedInts.Writer
,PackedInts.Reader
,PackedInts.ReaderIterator
- Only supports positive longs.
- Requires the number of bits per value to be known in advance.
- Supports both fast sequential access with low memory footprint with ReaderIterator and random-access by either loading values in memory or leaving them on disk with Reader.
BlockPackedWriter
,BlockPackedReader
,BlockPackedReaderIterator
- Splits the stream into fixed-size blocks.
- Compression is good when values are close to each other.
- Can address up to 2B * blockSize values.
MonotonicBlockPackedWriter
,MonotonicBlockPackedReader
- Same as the non-monotonic variants except that compression is good when the stream is a succession of affine functions.
- The reason why there is no sequential access is that if you need sequential access, you should rather delta-encode and use BlockPackedWriter.
PackedDataOutput
,PackedDataInput
- Writes sequences of longs where each long can use any number of bits.
-
ClassDescriptionUtility class to buffer a list of signed longs in memory.Utility class to buffer a list of signed longs in memory.Provides random access to a stream written with
BlockPackedWriter
.Reader for sequences of longs written withBlockPackedWriter
.A writer for large sequences of longs.A decoder for anEliasFanoEncoder
.A DocIdSet in Elias-Fano encoding.Encode a non decreasing sequence of non negative whole numbers in the Elias-Fano encoding that was introduced in the 1970's by Peter Elias and Robert Fano.ImplementsPackedInts.Mutable
, but grows the bit count of the underlying packed ints on-demand.Utility class to buffer signed longs in memory, which is optimized for the case where the sequence is monotonic, although it can encode any sequence of arbitrary longs.Provides random access to a stream written withMonotonicBlockPackedWriter
.A writer for large monotonically increasing sequences of positive longs.ADataInput
wrapper to read unaligned, variable-length packed integers.ADataOutput
wrapper to write unaligned, variable-length packed integers.Simplistic compression for array of unsigned long values.A decoder for packed integers.An encoder for packed integers.A format to write packed ints.Simple class that holds a format and a number of bits per value.Header identifying the structure of a packed integer array.A packed integer array that can be modified.APackedInts.Reader
which has all its values equal to 0 (bitsPerValue = 0).A read-only random access array of positive integers.Run-once iterator interface, to decode previously saved PackedInts.A write-once Writer.APagedMutable
.