com.sun.labs.minion.indexer.postings.io
Class FilePostingsInput

java.lang.Object
  extended by com.sun.labs.minion.indexer.postings.io.FilePostingsInput
All Implemented Interfaces:
PostingsInput

public class FilePostingsInput
extends java.lang.Object
implements PostingsInput

A postings input that is backed by a random access file.


Field Summary
protected  boolean full
          Whether we'll read all of the postings or read them incrementally.
protected  java.io.RandomAccessFile raf
          The file from which we'll read our postings.
 
Constructor Summary
FilePostingsInput(java.io.RandomAccessFile raf, boolean full)
          Creates a postings input that will read postings from the given file.
 
Method Summary
 ReadableBuffer read(long offset, int size)
          Returns a set of postings that are backed by the file on disk, so that minimal memory is used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

raf

protected java.io.RandomAccessFile raf
The file from which we'll read our postings.


full

protected boolean full
Whether we'll read all of the postings or read them incrementally.

Constructor Detail

FilePostingsInput

public FilePostingsInput(java.io.RandomAccessFile raf,
                         boolean full)
Creates a postings input that will read postings from the given file.

This implementation is most useful for reading postings that will be used in evaluating queries.

Parameters:
raf - The file that the postings will be read from.
full - If true then all of the postings will be read in at once.
Method Detail

read

public ReadableBuffer read(long offset,
                           int size)
                    throws java.io.IOException
Returns a set of postings that are backed by the file on disk, so that minimal memory is used.

Specified by:
read in interface PostingsInput
Parameters:
offset - The offset in the input at which the postings can be found.
size - The number of bytes to read to get the postings.
Returns:
A readable buffer containing the postings.
Throws:
java.io.IOException - if there is any error reading the postings.