abstract class ParserIterator<T> extends java.lang.Object implements IterableResult<T,ParsingContext>
Iterator
over the parser enabling easy iteration against rows and records
Multiple iterations are possible if Files are being fed into the parser,
but other forms of input (such as InputStream
s and Reader
s) can not be iterated over more than once.Modifier and Type | Field and Description |
---|---|
protected AbstractParser |
parser |
Modifier | Constructor and Description |
---|---|
protected |
ParserIterator(AbstractParser parser)
Creates a
ParserIterator using the provided parser |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
beginParsing()
This method is called whenever the
iterator is starting to iterate over the
results. |
ParsingContext |
getContext()
Returns the current parsing
Context , if available |
ResultIterator<T,ParsingContext> |
iterator() |
protected abstract T |
nextResult()
Returns the next record (either a String[] or a
Record ) |
protected final AbstractParser parser
protected ParserIterator(AbstractParser parser)
ParserIterator
using the provided parser
parser
- the parser
to iterate overpublic final ParsingContext getContext()
IterableResult
Context
, if availablegetContext
in interface IterableResult<T,ParsingContext>
protected abstract void beginParsing()
iterator
is starting to iterate over the
results.
an example implementation of this is:
@Override
public void beginParsing(){
parser.beginParsing(input);
}
Reader, File, or InputStream
without large code
reuse.public final ResultIterator<T,ParsingContext> iterator()
iterator
in interface IterableResult<T,ParsingContext>
iterator
in interface java.lang.Iterable<T>