edu.stanford.nlp.objectbank
Class ResettableReaderIteratorFactory

java.lang.Object
  extended by edu.stanford.nlp.objectbank.ReaderIteratorFactory
      extended by edu.stanford.nlp.objectbank.ResettableReaderIteratorFactory

public class ResettableReaderIteratorFactory
extends ReaderIteratorFactory

Vends ReaderIterators which can alway be rewound. Java's Readers cannot be reset, but this ReaderIteratorFactory allows resetting. It the input types are anything other than Readers, then it resets them in the obvious way. If the input is a Reader, then it's contents are saved to a tmp file (which is destroyed when the VM exits) which is then resettable.

Author:
Jenny Finkel

Field Summary
 
Fields inherited from class edu.stanford.nlp.objectbank.ReaderIteratorFactory
c
 
Constructor Summary
ResettableReaderIteratorFactory()
          Constructs a ResettableReaderIteratorFactory with no initial input sources.
ResettableReaderIteratorFactory(Collection c)
          Constructs a ResettableReaderIteratorFactory from the input sources contained in the Collection.
ResettableReaderIteratorFactory(Object o)
          Convenience constructor to construct a ResettableReaderIteratorFactory from a single input source.
 
Method Summary
 Iterator<Reader> iterator()
          Returns an Iterator over the input sources in the underlying Collection.
 
Methods inherited from class edu.stanford.nlp.objectbank.ReaderIteratorFactory
add, addAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResettableReaderIteratorFactory

public ResettableReaderIteratorFactory(Collection c)
Constructs a ResettableReaderIteratorFactory from the input sources contained in the Collection. The Collection should contain Objects of type File, String, URL and Reader. See class description for details.

Parameters:
c - Collection of input sources.

ResettableReaderIteratorFactory

public ResettableReaderIteratorFactory(Object o)
Convenience constructor to construct a ResettableReaderIteratorFactory from a single input source. The Object should be of type File, String, URL and Reader. See class description for details.

Parameters:
o - an input source that can be converted into a Reader

ResettableReaderIteratorFactory

public ResettableReaderIteratorFactory()
Constructs a ResettableReaderIteratorFactory with no initial input sources.

Method Detail

iterator

public Iterator<Reader> iterator()
Returns an Iterator over the input sources in the underlying Collection.

Overrides:
iterator in class ReaderIteratorFactory
Returns:
an Iterator over the input sources in the underlying Collection.


Stanford NLP Group