public class ReaderIteratorFactory
extends java.lang.Object
implements java.lang.Iterable<java.io.Reader>
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.
Modifier and Type | Field and Description |
---|---|
protected java.util.Collection<java.lang.Object> |
c
The underlying Collection of input sources.
|
protected java.lang.String |
enc
The encoding for file input.
|
Constructor and Description |
---|
ReaderIteratorFactory() |
ReaderIteratorFactory(java.util.Collection<?> c)
Constructs a ReaderIteratorFactory from the input sources
contained in the Collection.
|
ReaderIteratorFactory(java.util.Collection<?> c,
java.lang.String encoding) |
ReaderIteratorFactory(java.lang.Object o)
Convenience constructor to construct a ReaderIteratorFactory from a single
input source.
|
ReaderIteratorFactory(java.lang.Object o,
java.lang.String encoding) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.Object o)
Adds an Object to the underlying Collection of input sources.
|
boolean |
addAll(java.util.Collection<?> c)
Adds all Objects in Collection c to the underlying Collection of
input sources.
|
java.util.Iterator<java.io.Reader> |
iterator()
Returns an Iterator over the input sources in the underlying Collection.
|
boolean |
remove(java.lang.Object o)
Removes an Object from the underlying Collection of input sources.
|
boolean |
removeAll(java.util.Collection<?> c)
Removes all Objects in Collection c from the underlying Collection of
input sources.
|
boolean |
retainAll(java.util.Collection<?> c)
Removes all Objects from the underlying Collection of input sources
except those in Collection c
|
protected java.util.Collection<java.lang.Object> c
protected java.lang.String enc
File
.public ReaderIteratorFactory(java.util.Collection<?> c)
c
- Collection of input sources.public ReaderIteratorFactory(java.util.Collection<?> c, java.lang.String encoding)
public ReaderIteratorFactory(java.lang.Object o)
o
- an input source that can be converted into a Readerpublic ReaderIteratorFactory(java.lang.Object o, java.lang.String encoding)
public ReaderIteratorFactory()
public java.util.Iterator<java.io.Reader> iterator()
iterator
in interface java.lang.Iterable<java.io.Reader>
public boolean add(java.lang.Object o)
o
- Input source to be added to the underlying Collection.public boolean remove(java.lang.Object o)
o
- Input source to be removed from the underlying Collection.public boolean addAll(java.util.Collection<?> c)
c
- Collection of input sources to be added to the underlying Collection.public boolean removeAll(java.util.Collection<?> c)
c
- Collection of input sources to be removed from the underlying Collection.public boolean retainAll(java.util.Collection<?> c)
c
- Collection of input sources to be retained in the underlying Collection.