public class DocsFreqBlockIndexOutput.DocsFreqBlockWriter extends BlockIndexOutput.BlockWriter
BlockWriter
for the .doc file.
Encode and write blocks containing the document identifiers and the node frequencies. It also encodes the pointers of the associated blocks from the .nod and .pos files into the block header.
This class must be associated to the Index
s of the
NodBlockIndexOutput.NodBlockWriter
and PosBlockIndexOutput.PosBlockWriter
using
#setNodeBlockIndex(Index)
and #setPosBlockIndex(Index)
.
Constructor and Description |
---|
DocsFreqBlockIndexOutput.DocsFreqBlockWriter() |
Modifier and Type | Method and Description |
---|---|
protected void |
compress()
Compress the data block
|
int |
getFirstDocId() |
int |
getMaxBlockSize() |
protected void |
initBlock()
Init writer for new block
|
boolean |
isEmpty() |
boolean |
isFull() |
void |
setNodeBlockIndex(BlockIndexOutput.Index index)
Set the
Index of the NodBlockIndexOutput . |
void |
setPosBlockIndex(BlockIndexOutput.Index index)
Set the
Index of the PosBlockIndexOutput . |
void |
write(int docId)
Add a document identifier to the buffer.
|
protected void |
writeData()
Write compressed data block to the output file
|
protected void |
writeHeader()
Write block header to the output file
|
void |
writeNodeFreq(int nodeFreqInDoc)
Add a node frenquency to the buffer.
|
flush, getMinimumBufferSize, writeBlock
public DocsFreqBlockIndexOutput.DocsFreqBlockWriter()
public int getMaxBlockSize()
public int getFirstDocId()
public void setNodeBlockIndex(BlockIndexOutput.Index index) throws IOException
Index
of the NodBlockIndexOutput
. The
Index
is used to read the current file pointer of the
NodBlockIndexOutput
when flushing a block.IOException
public void setPosBlockIndex(BlockIndexOutput.Index index) throws IOException
Index
of the PosBlockIndexOutput
. The
Index
is used to read the current file pointer of the
PosBlockIndexOutput
when flushing a block.IOException
public void write(int docId) throws IOException
IOException
public void writeNodeFreq(int nodeFreqInDoc)
public boolean isEmpty()
isEmpty
in class BlockIndexOutput.BlockWriter
public boolean isFull()
isFull
in class BlockIndexOutput.BlockWriter
protected void compress()
BlockIndexOutput.BlockWriter
compress
in class BlockIndexOutput.BlockWriter
protected void writeHeader() throws IOException
BlockIndexOutput.BlockWriter
writeHeader
in class BlockIndexOutput.BlockWriter
IOException
protected void writeData() throws IOException
BlockIndexOutput.BlockWriter
writeData
in class BlockIndexOutput.BlockWriter
IOException
protected void initBlock()
BlockIndexOutput.BlockWriter
initBlock
in class BlockIndexOutput.BlockWriter
Copyright © 2014. All rights reserved.