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 InputStreams and Readers) 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 parserparser - the parser to iterate overpublic final ParsingContext getContext()
IterableResultContext, 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>