public final class MonotonicBlockPackedWriter
extends java.lang.Object
The sequence is divided into fixed-size blocks and for each block, values are modeled after a linear function f: x → A × x + B. The block encodes deltas from the expected values computed from this function using as few bits as possible.
Format:
zig-zag encoded
vLong
Float.floatToIntBits(float) on
4 bytes
variable-length int
packed deltas from the expected value
(computed from the function) using exaclty BitsPerValue bits per value.
MonotonicBlockPackedReader| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
blocks |
protected boolean |
finished |
protected int |
off |
protected long |
ord |
protected DataOutput |
out |
protected long[] |
values |
| Constructor and Description |
|---|
MonotonicBlockPackedWriter(DataOutput out,
int blockSize)
Sole constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(long l)
Append a new long.
|
void |
finish()
Flush all buffered data to disk.
|
protected void |
flush() |
long |
ord()
Return the number of values which have been added.
|
void |
reset(DataOutput out)
Reset this writer to wrap
out. |
protected void |
writeValues(int bitsRequired) |
protected DataOutput out
protected final long[] values
protected byte[] blocks
protected int off
protected long ord
protected boolean finished
public MonotonicBlockPackedWriter(DataOutput out, int blockSize)
blockSize - the number of values of a single block, must be a power of 2public void add(long l)
throws java.io.IOException
java.io.IOExceptionprotected void flush()
throws java.io.IOException
java.io.IOExceptionpublic void reset(DataOutput out)
out. The block size remains unchanged.public void finish()
throws java.io.IOException
reset(DataOutput) has
been called.java.io.IOExceptionpublic long ord()
protected final void writeValues(int bitsRequired)
throws java.io.IOException
java.io.IOExceptionCopyright © 2000–2025 The Apache Software Foundation. All rights reserved.