edu.stanford.nlp.objectbank
Class ResettableReaderIteratorFactory
java.lang.Object
edu.stanford.nlp.objectbank.ReaderIteratorFactory
edu.stanford.nlp.objectbank.ResettableReaderIteratorFactory
- All Implemented Interfaces:
- Iterable<Reader>
public class ResettableReaderIteratorFactory
- extends ReaderIteratorFactory
Vends ReaderIterators which can always 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
Method Summary |
Iterator<Reader> |
iterator()
Returns an Iterator over the input sources in the underlying Collection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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(Collection<?> c,
String encoding)
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(Object o,
String encoding)
ResettableReaderIteratorFactory
public ResettableReaderIteratorFactory()
- Constructs a ResettableReaderIteratorFactory with no initial
input sources.
iterator
public Iterator<Reader> iterator()
- Returns an Iterator over the input sources in the underlying Collection.
- Specified by:
iterator
in interface Iterable<Reader>
- Overrides:
iterator
in class ReaderIteratorFactory
- Returns:
- an Iterator over the input sources in the underlying Collection.
Stanford NLP Group