public static interface Source.Reader<T>
extends java.lang.AutoCloseable
This interface is deliberately distinct from Iterator because
the current model tends to be easier to program and more efficient in practice
for iterating over sources such as files, databases etc. (rather than pure collections).
To read a SourceIterator:
while (iterator.advance()) {
T item = iterator.getCurrent();
...
}
Note: this interface is work-in-progress and may change.
| Modifier and Type | Method and Description |
|---|---|
boolean |
advance()
Advances the iterator to the next valid record.
|
void |
close()
Closes the iterator.
|
T |
getCurrent()
Returns the value of the data item which was read by the last
advance() call. |
boolean advance()
throws java.io.IOException
getCurrent() call.true if a record was read, false if we're at the end of input.java.io.IOExceptionT getCurrent() throws java.util.NoSuchElementException
advance() call.void close()
throws java.io.IOException
close in interface java.lang.AutoCloseablejava.io.IOException