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 intBPV_SHIFTprotected booleanfinished(package private) static intMAX_BLOCK_SIZE(package private) static intMIN_BLOCK_SIZE(package private) static intMIN_VALUE_EQUALS_0protected intoffprotected longordprotected DataOutputoutprotected long[]values
-
Constructor Summary
Constructors Constructor Description AbstractBlockPackedWriter(DataOutput out, int blockSize)Sole constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(long l)Append a new long.(package private) voidaddBlockOfZeros()private voidcheckNotFinished()voidfinish()Flush all buffered data to disk.protected abstract voidflush()longord()Return the number of values which have been added.voidreset(DataOutput out)Reset this writer to wrapout.protected voidwriteValues(int bitsRequired)(package private) static voidwriteVLong(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
public AbstractBlockPackedWriter(DataOutput out, int blockSize)
Sole constructor.- Parameters:
blockSize- the number of values of a single block, must be a multiple of 64
-
-
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.IOExceptionAppend 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.IOExceptionFlush 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
-
-