Package org.apache.lucene.util.packed
Class AbstractBlockPackedWriter
- java.lang.Object
-
- org.apache.lucene.util.packed.AbstractBlockPackedWriter
-
- Direct Known Subclasses:
BlockPackedWriter
,MonotonicBlockPackedWriter
abstract class AbstractBlockPackedWriter extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
blocks
(package private) static int
BPV_SHIFT
protected boolean
finished
(package private) static int
MAX_BLOCK_SIZE
(package private) static int
MIN_BLOCK_SIZE
(package private) static int
MIN_VALUE_EQUALS_0
protected int
off
protected long
ord
protected DataOutput
out
protected long[]
values
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractBlockPackedWriter(DataOutput out, int blockSize)
Sole constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
add(long l)
Append a new long.(package private) void
addBlockOfZeros()
private void
checkNotFinished()
void
finish()
Flush all buffered data to disk.protected abstract void
flush()
long
ord()
Return the number of values which have been added.void
reset(DataOutput out)
Reset this writer to wrapout
.protected void
writeValues(int bitsRequired)
(package private) static void
writeVLong(DataOutput out, long i)
-
-
-
Field Detail
-
MIN_BLOCK_SIZE
static final int MIN_BLOCK_SIZE
- See Also:
- Constant Field Values
-
MAX_BLOCK_SIZE
static final int MAX_BLOCK_SIZE
- See Also:
- Constant Field Values
-
MIN_VALUE_EQUALS_0
static final int MIN_VALUE_EQUALS_0
- See Also:
- Constant Field Values
-
BPV_SHIFT
static final int BPV_SHIFT
- See Also:
- Constant Field Values
-
out
protected DataOutput out
-
values
protected final long[] values
-
blocks
protected byte[] blocks
-
off
protected int off
-
ord
protected long ord
-
finished
protected boolean finished
-
-
Constructor Detail
-
AbstractBlockPackedWriter
protected AbstractBlockPackedWriter(DataOutput out, int blockSize)
Sole constructor.- Parameters:
blockSize
- the number of values of a single block, must be a multiple of64
-
-
Method Detail
-
writeVLong
static void writeVLong(DataOutput out, long i) throws java.io.IOException
- Throws:
java.io.IOException
-
reset
public void reset(DataOutput out)
Reset this writer to wrapout
. The block size remains unchanged.
-
checkNotFinished
private void checkNotFinished()
-
add
public void add(long l) throws java.io.IOException
Append a new long.- Throws:
java.io.IOException
-
addBlockOfZeros
void addBlockOfZeros() throws java.io.IOException
- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOException
Flush all buffered data to disk. This instance is not usable anymore after this method has been called untilreset(DataOutput)
has been called.- Throws:
java.io.IOException
-
ord
public long ord()
Return the number of values which have been added.
-
flush
protected abstract void flush() throws java.io.IOException
- Throws:
java.io.IOException
-
writeValues
protected final void writeValues(int bitsRequired) throws java.io.IOException
- Throws:
java.io.IOException
-
-