Textractor API textractor-720 (20091120123250)

textractor.mg4j.document
Class TextractorQueueDocumentSequence

java.lang.Object
  extended by textractor.mg4j.document.TextractorQueueDocumentSequence
All Implemented Interfaces:
DocumentSequence, Closeable

public final class TextractorQueueDocumentSequence
extends Object
implements DocumentSequence


Constructor Summary
TextractorQueueDocumentSequence(DocumentFactory factory, SentenceFilter filter, BlockingQueue<Sentence> queue, Semaphore semaphore, int loaderThreadCount)
           
 
Method Summary
 void close()
          Closes this document sequence, releasing all resources.
 DocumentFactory factory()
          Returns the factory used by this sequence.
 DocumentIterator iterator()
          Returns an iterator over the sequence of documents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextractorQueueDocumentSequence

public TextractorQueueDocumentSequence(DocumentFactory factory,
                                       SentenceFilter filter,
                                       BlockingQueue<Sentence> queue,
                                       Semaphore semaphore,
                                       int loaderThreadCount)
Method Detail

iterator

public DocumentIterator iterator()
Returns an iterator over the sequence of documents.

Warning: this method can be safely called just one time. For instance, implementations based on standard input will usually throw an exception if this method is called twice.

Implementations may decide to override this restriction (in particular, if they implement DocumentCollection). Usually, however, it is not possible to obtain two iterators at the same time on a collection.

Specified by:
iterator in interface DocumentSequence
Returns:
an iterator over the sequence of documents.
See Also:
DocumentCollection

factory

public DocumentFactory factory()
Returns the factory used by this sequence.

Every document sequence is based on a document factory that transforms raw bytes into a sequence of characters. The factory contains useful information such as the number of fields.

Specified by:
factory in interface DocumentSequence
Returns:
the factory used by this sequence.

close

public void close()
Closes this document sequence, releasing all resources.

You should always call this method after having finished with this document sequence. Implementations are invited to call this method in a finaliser as a safety net (even better, implement SafelyCloseable), but since there is no guarantee as to when finalisers are invoked, you should not depend on this behaviour.

Specified by:
close in interface DocumentSequence
Specified by:
close in interface Closeable

Textractor API textractor-720 (20091120123250)

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