Class BlockLine.Serializer
java.lang.Object
org.apache.lucene.codecs.uniformsplit.BlockLine.Serializer
- All Implemented Interfaces:
Accountable
- Direct Known Subclasses:
STBlockLine.Serializer
- Enclosing class:
- BlockLine
Reads/writes block lines with terms encoded incrementally inside a block. This class keeps a
state of the previous term read to decode the next term.
-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static int
numBitsToEncode
(int i) Gets the number of bits required to encode the value of the provided int.long
protected void
protected TermBytes
readIncrementallyEncodedTerm
(DataInput blockInput, boolean isIncrementalEncodingSeed, TermBytes reuse) Reads the current line.protected void
writeIncrementallyEncodedTerm
(TermBytes termBytes, TermBytes previousTermBytes, boolean isIncrementalEncodingSeed, DataOutput blockOutput) void
writeLine
(DataOutput blockOutput, BlockLine line, BlockLine previousLine, int termStateRelativeOffset, boolean isIncrementalEncodingSeed) Writes a line and its offset to the corresponding term state details in the details region.protected void
writeLineTermState
(DataOutput termStatesOutput, BlockLine line, FieldInfo fieldInfo, DeltaBaseTermStateSerializer encoder) Writes the term state details of a line in the details region.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Field Details
-
currentTerm
-
-
Constructor Details
-
Serializer
public Serializer()
-
-
Method Details
-
readLine
public BlockLine readLine(DataInput blockInput, boolean isIncrementalEncodingSeed, BlockLine reuse) throws IOException Reads the current line.- Parameters:
isIncrementalEncodingSeed
- Whether the term is a seed of the incremental encoding.true
for the first and middle term,false
for other terms.reuse
- ABlockLine
instance to reuse; or null if none.- Throws:
IOException
-
writeLine
public void writeLine(DataOutput blockOutput, BlockLine line, BlockLine previousLine, int termStateRelativeOffset, boolean isIncrementalEncodingSeed) throws IOException Writes a line and its offset to the corresponding term state details in the details region.- Parameters:
blockOutput
- The output pointing to the block terms region.termStateRelativeOffset
- The offset to the corresponding term state details in the details region.isIncrementalEncodingSeed
- Whether the term is a seed of the incremental encoding.true
for the first and middle term,false
for other terms.- Throws:
IOException
-
writeLineTermState
protected void writeLineTermState(DataOutput termStatesOutput, BlockLine line, FieldInfo fieldInfo, DeltaBaseTermStateSerializer encoder) throws IOException Writes the term state details of a line in the details region.- Parameters:
termStatesOutput
- The output pointing to the details region.- Throws:
IOException
-
writeIncrementallyEncodedTerm
protected void writeIncrementallyEncodedTerm(TermBytes termBytes, TermBytes previousTermBytes, boolean isIncrementalEncodingSeed, DataOutput blockOutput) throws IOException - Throws:
IOException
-
readIncrementallyEncodedTerm
protected TermBytes readIncrementallyEncodedTerm(DataInput blockInput, boolean isIncrementalEncodingSeed, TermBytes reuse) throws IOException - Throws:
IOException
-
readBytes
protected void readBytes(DataInput input, BytesRef bytes, int offset, int length) throws IOException - Throws:
IOException
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsed
in interfaceAccountable
-
numBitsToEncode
protected static int numBitsToEncode(int i) Gets the number of bits required to encode the value of the provided int. Returns 0 for int value 0. Equivalent to (log2(i) + 1).
-