Package org.apache.lucene.util.packed
Class DirectMonotonicWriter
java.lang.Object
org.apache.lucene.util.packed.DirectMonotonicWriter
Write monotonically-increasing sequences of integers. This writer splits data into blocks and
then for each block, computes the average slope, the minimum value and only encode the delta from
the expected value using a
DirectWriter
.- See Also:
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(long v) Write a new value.void
finish()
This must be called exactly once after all values have beenadded
.static DirectMonotonicWriter
getInstance
(IndexOutput metaOut, IndexOutput dataOut, long numValues, int blockShift) Returns an instance suitable for encodingnumValues
into monotonic blocks of 2blockShift
values.
-
Field Details
-
MIN_BLOCK_SHIFT
public static final int MIN_BLOCK_SHIFT- See Also:
-
MAX_BLOCK_SHIFT
public static final int MAX_BLOCK_SHIFT- See Also:
-
-
Method Details
-
add
Write a new value. Note that data might not make it to storage untilfinish()
is called.- Throws:
IllegalArgumentException
- if values don't come in orderIOException
-
finish
This must be called exactly once after all values have beenadded
.- Throws:
IOException
-
getInstance
public static DirectMonotonicWriter getInstance(IndexOutput metaOut, IndexOutput dataOut, long numValues, int blockShift) Returns an instance suitable for encodingnumValues
into monotonic blocks of 2blockShift
values. Metadata will be written tometaOut
and actual data todataOut
.
-