Package org.terrier.structures.bit
Class BlockDirectInvertedOutputStream
- java.lang.Object
-
- org.terrier.structures.AbstractPostingOutputStream
-
- org.terrier.structures.bit.DirectInvertedOutputStream
-
- org.terrier.structures.bit.BlockDirectInvertedOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class BlockDirectInvertedOutputStream extends DirectInvertedOutputStream
Writes a block direct or block inverted index, when passed appropriate posting lists.- Since:
- 2.0
- Author:
- Craig Macdonald
-
-
Field Summary
-
Fields inherited from class org.terrier.structures.bit.DirectInvertedOutputStream
lastDocid, logger, output
-
-
Constructor Summary
Constructors Constructor Description BlockDirectInvertedOutputStream(java.io.OutputStream os)
BlockDirectInvertedOutputStream(java.lang.String filename)
Creates a new output stream, writing a BitOutputStream to the specified file.BlockDirectInvertedOutputStream(BitOut out)
Creates a new output stream, writing to the specified BitOut implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<? extends IterablePosting>
getPostingIteratorClass()
Returns the IterablePosting class to use for reading structure written by this classprotected BitIndexPointer
writeNoFieldPostings(int[][] postings, int offset, int length, int firstId)
Writes the given block postings to the bit file.protected void
writePostingNotDocid(Posting _p)
Hook method for writing out the remainder of the posting-
Methods inherited from class org.terrier.structures.bit.DirectInvertedOutputStream
close, getBitOffset, getBitOut, getByteOffset, getLastDocidWritten, getOffset, writePostings, writePostings, writePostings, writePostings, writePostings, writePostings
-
-
-
-
Constructor Detail
-
BlockDirectInvertedOutputStream
public BlockDirectInvertedOutputStream(java.lang.String filename) throws java.io.IOException
Creates a new output stream, writing a BitOutputStream to the specified file. The number of binary bits for fields must also be specified.- Parameters:
filename
- Location of the file to write to- Throws:
java.io.IOException
-
BlockDirectInvertedOutputStream
public BlockDirectInvertedOutputStream(BitOut out)
Creates a new output stream, writing to the specified BitOut implementation. The number of binary bits for fields must also be specified.- Parameters:
out
- BitOut implementation to write the file to
-
BlockDirectInvertedOutputStream
public BlockDirectInvertedOutputStream(java.io.OutputStream os) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getPostingIteratorClass
public java.lang.Class<? extends IterablePosting> getPostingIteratorClass()
Description copied from class:DirectInvertedOutputStream
Returns the IterablePosting class to use for reading structure written by this class- Overrides:
getPostingIteratorClass
in classDirectInvertedOutputStream
-
writeNoFieldPostings
protected BitIndexPointer writeNoFieldPostings(int[][] postings, int offset, int length, int firstId) throws java.io.IOException
Writes the given block postings to the bit file. This method assumes that field information is not provided.- Overrides:
writeNoFieldPostings
in classDirectInvertedOutputStream
- Parameters:
postings
- the postings list to write.firstId
- the first identifier to write. This can be an id plus one, or the gap of the current id and the previous one.offset
- The location of the first posting to write out.length
- The number of postings to be written out.- Throws:
java.io.IOException
- if an error occurs during writing to a file.
-
writePostingNotDocid
protected void writePostingNotDocid(Posting _p) throws java.io.IOException
Description copied from class:DirectInvertedOutputStream
Hook method for writing out the remainder of the posting- Overrides:
writePostingNotDocid
in classDirectInvertedOutputStream
- Throws:
java.io.IOException
-
-