|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.packed.MonotonicBlockPackedWriter
public final class MonotonicBlockPackedWriter
A writer for large monotonically increasing sequences of positive longs.
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. Each block has an overhead between 6 and 14 bytes.
Format:
variable-length long
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
Field Summary | |
---|---|
protected byte[] |
blocks
|
protected boolean |
finished
|
protected int |
off
|
protected long |
ord
|
protected DataOutput |
out
|
protected long[] |
values
|
Constructor Summary | |
---|---|
MonotonicBlockPackedWriter(DataOutput out,
int blockSize)
Sole constructor. |
Method Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DataOutput out
protected final long[] values
protected byte[] blocks
protected int off
protected long ord
protected boolean finished
Constructor Detail |
---|
public MonotonicBlockPackedWriter(DataOutput out, int blockSize)
blockSize
- the number of values of a single block, must be a power of 2Method Detail |
---|
public void add(long l) throws IOException
IOException
protected void flush() throws IOException
IOException
public void reset(DataOutput out)
out
. The block size remains unchanged.
public void finish() throws IOException
reset(DataOutput)
has
been called.
IOException
public long ord()
protected final void writeValues(int bitsRequired) throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |