Terrier IR Platform
2.2.1

uk.ac.gla.terrier.structures
Class DirectInvertedOutputStream

java.lang.Object
  extended by uk.ac.gla.terrier.structures.DirectInvertedOutputStream
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
BlockDirectInvertedOutputStream

public class DirectInvertedOutputStream
extends java.lang.Object
implements Closeable

Writes a block direct or block inverted index, when passed appropriate posting lists.

Since:
2.0
Version:
$Revision: 1.3 $
Author:
Craig Macdonald

Constructor Summary
DirectInvertedOutputStream(BitOut out, int binaryBits)
          Creates a new output stream, writing to the specified BitOut implementation.
DirectInvertedOutputStream(java.lang.String filename, int binaryBits)
          Creates a new output stream, writing a BitOutputStream to the specified file.
 
Method Summary
 void close()
          close this object.
 byte getBitOffset()
          Return the current offset in bits in the written file
 BitOut getBitOut()
          Return the underlying BitOut implementation being used by the class
 long getByteOffset()
          Return the current offset in bytes in the written file
 void writePostings(int[][] postings, int firstId)
          Write out the specified postings.
 void writePostings(int[][] postings, int startOffset, int Length, int firstId)
          Write out a range of the specified postings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectInvertedOutputStream

public DirectInvertedOutputStream(java.lang.String filename,
                                  int binaryBits)
                           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
binaryBits - the number of fields in this index
Throws:
java.io.IOException

DirectInvertedOutputStream

public DirectInvertedOutputStream(BitOut out,
                                  int binaryBits)
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
binaryBits - the number of fields in this index
Method Detail

writePostings

public void writePostings(int[][] postings,
                          int firstId)
                   throws java.io.IOException
Write out the specified postings. The delta for the first id must be specified.

Parameters:
postings - The postings to write out
firstId - the (delta) value of the first docid to write out.
Throws:
java.io.IOException

writePostings

public void writePostings(int[][] postings,
                          int startOffset,
                          int Length,
                          int firstId)
                   throws java.io.IOException
Write out a range of the specified postings. The delta for the first id must be specified.

Parameters:
postings - The postings to write out
startOffset - The location of the first posting to write out.
Length - The number of postings to be written out.
firstId - the (delta) value of the first docid to write out.
Throws:
java.io.IOException

close

public void close()
close this object. suppresses any exception

Specified by:
close in interface Closeable

getByteOffset

public long getByteOffset()
Return the current offset in bytes in the written file


getBitOffset

public byte getBitOffset()
Return the current offset in bits in the written file


getBitOut

public BitOut getBitOut()
Return the underlying BitOut implementation being used by the class


Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow