org.terrier.structures
Class BlockDirectInvertedOutputStream

java.lang.Object
  extended by org.terrier.structures.DirectInvertedOutputStream
      extended by org.terrier.structures.BlockDirectInvertedOutputStream
All Implemented Interfaces:
java.io.Closeable

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.DirectInvertedOutputStream
logger, output
 
Constructor Summary
BlockDirectInvertedOutputStream(BitOut out)
          Creates a new output stream, writing to the specified BitOut implementation.
BlockDirectInvertedOutputStream(java.lang.String filename)
          Creates a new output stream, writing a BitOutputStream to the specified file.
 
Method Summary
 java.lang.Class<? extends IterablePosting> getPostingIteratorClass()
          Returns the IterablePosting class to use for reading structure written by this class
protected  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.DirectInvertedOutputStream
close, getBitOffset, getBitOut, getByteOffset, getOffset, writePostings, writePostings, writePostings, writePostings, writePostings, writePostings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
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 class DirectInvertedOutputStream

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 class DirectInvertedOutputStream
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 class DirectInvertedOutputStream
Throws:
java.io.IOException


Terrier 3.5. Copyright © 2004-2011 University of Glasgow