Textractor API textractor-720 (20091120123250)

textractor.mg4j.docstore
Class StringPerDocumentReader

java.lang.Object
  extended by textractor.mg4j.docstore.StringPerDocumentReader
All Implemented Interfaces:
Closeable

public class StringPerDocumentReader
extends Object
implements Closeable

When one String value per document in the index needs to be read, this class can aid in doing that. This can be used to write DOI values, etc. See StringPerDocumentWriter for the class that writes these strings.

Author:
Kevin Dorff

Field Summary
static int OFFSET_ENTRY_SIZE
          We are using writeInt for pos and writeInt for string length, so, the string offset entry size is 8 bytes.
 
Method Summary
 void close()
          Closes this reader and releases any system resources associated with it.
static String getDataFilename(String basename, String filenameSuffix)
           
static String getOffsetsFilename(String basename, String filenameSuffix)
           
static StringPerDocumentReader obtainReader(DocumentIndexManager manager, String filenameSuffix)
           
 String readStringForDocument(int documentIndex)
          Retrieves the string value for the document if it exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OFFSET_ENTRY_SIZE

public static final int OFFSET_ENTRY_SIZE
We are using writeInt for pos and writeInt for string length, so, the string offset entry size is 8 bytes. This is in bits.

See Also:
Constant Field Values
Method Detail

obtainReader

public static StringPerDocumentReader obtainReader(DocumentIndexManager manager,
                                                   String filenameSuffix)

getDataFilename

public static String getDataFilename(String basename,
                                     String filenameSuffix)

getOffsetsFilename

public static String getOffsetsFilename(String basename,
                                        String filenameSuffix)

readStringForDocument

public String readStringForDocument(int documentIndex)
                             throws IOException
Retrieves the string value for the document if it exists.

Parameters:
documentIndex - the document index for this article
Returns:
The string value for the document
Throws:
IOException - error writing data

close

public void close()
           throws IOException
Closes this reader and releases any system resources associated with it. If the reader is already closed then invoking this method has no effect.

Specified by:
close in interface Closeable
Throws:
IOException - if an I/O error occurs

Textractor API textractor-720 (20091120123250)

Copyright © 2003-2008 Institute for Computational Biomedicine, All Rights Reserved.