|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.objectbank.ReaderIteratorFactory
public class ReaderIteratorFactory
A ReaderIteratorFactory provides a means of getting an Iterator which returns java.util.Readers over a Collection of input sources. Currently supported input sources are: Files, Strings, URLs and Readers. A ReaderIteratorFactory may take a Collection on construction and new sources may be added either individually (via the add(Object) method) or as a Collection (via the addAll(Collection method). The implementation automatically determines the type of input and produces a java.util.Reader accordingly. If you wish to add support for a new kind of input, refer the the setNextObject() method of the nested class ReaderIterator.
The Readers returned by this class are not closed by the class when you move to the next element (nor at any other time). So, if you want the files closed, then the caller needs to close them. The caller can only do this if they pass in Readers. Otherwise, this class should probably close them but currently doesn't.
TODO: Have this class close the files that it opens.
Field Summary | |
---|---|
protected Collection<Object> |
c
The underlying Collection of input sources. |
protected String |
enc
The encoding for file input. |
Constructor Summary | |
---|---|
ReaderIteratorFactory()
|
|
ReaderIteratorFactory(Collection<?> c)
Constructs a ReaderIteratorFactory from the input sources contained in the Collection. |
|
ReaderIteratorFactory(Collection<?> c,
String encoding)
|
|
ReaderIteratorFactory(Object o)
Convenience constructor to construct a ReaderIteratorFactory from a single input source. |
|
ReaderIteratorFactory(Object o,
String encoding)
|
Method Summary | |
---|---|
boolean |
add(Object o)
Adds an Object to the underlying Collection of input sources. |
boolean |
addAll(Collection<?> c)
Adds all Objects in Collection c to the underlying Collection of input sources. |
Iterator<Reader> |
iterator()
Returns an Iterator over the input sources in the underlying Collection. |
boolean |
remove(Object o)
Removes an Object from the underlying Collection of input sources. |
boolean |
removeAll(Collection<?> c)
Removes all Objects in Collection c from the underlying Collection of input sources. |
boolean |
retainAll(Collection<?> c)
Removes all Objects from the underlying Collection of input sources except those in Collection c |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Collection<Object> c
protected String enc
File
.
Constructor Detail |
---|
public ReaderIteratorFactory(Collection<?> c)
c
- Collection of input sources.public ReaderIteratorFactory(Collection<?> c, String encoding)
public ReaderIteratorFactory(Object o)
o
- an input source that can be converted into a Readerpublic ReaderIteratorFactory(Object o, String encoding)
public ReaderIteratorFactory()
Method Detail |
---|
public Iterator<Reader> iterator()
public boolean add(Object o)
o
- Input source to be added to the underlying Collection.public boolean remove(Object o)
o
- Input source to be removed from the underlying Collection.public boolean addAll(Collection<?> c)
c
- Collection of input sources to be added to the underlying Collection.public boolean removeAll(Collection<?> c)
c
- Collection of input sources to be removed from the underlying Collection.public boolean retainAll(Collection<?> c)
c
- Collection of input sources to be retained in the underlying Collection.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |