Class RecordIterator
- java.lang.Object
-
- com.univocity.parsers.common.iterators.RecordIterator
-
- All Implemented Interfaces:
IterableResult<Record,ParsingContext>
,java.lang.Iterable<Record>
public abstract class RecordIterator extends java.lang.Object
An iterator ofRecord
s. Created whenAbstractParser.iterateRecords(File)
(and its overloaded counterparts) is called- Author:
- uniVocity Software Pty Ltd - dev@univocity.com
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractParser
parser
-
Constructor Summary
Constructors Constructor Description RecordIterator(AbstractParser parser)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
beginParsing()
This method is called whenever theiterator
is starting to iterate over the results.ParsingContext
getContext()
Returns the current parsingContext
, if availableResultIterator<T,ParsingContext>
iterator()
protected Record
nextResult()
Returns the next record (either a String[] or aRecord
)
-
-
-
Field Detail
-
parser
protected final AbstractParser parser
-
-
Constructor Detail
-
RecordIterator
public RecordIterator(AbstractParser parser)
-
-
Method Detail
-
nextResult
protected final Record nextResult()
Returns the next record (either a String[] or aRecord
)- Returns:
- the next record if available.
-
getContext
public final ParsingContext getContext()
Description copied from interface:IterableResult
Returns the current parsingContext
, if available- Specified by:
getContext
in interfaceIterableResult<T,ParsingContext>
- Returns:
- the contextual object with information about an ongoing parsing process
-
beginParsing
protected abstract void beginParsing()
This method is called whenever theiterator
is starting to iterate over the results. an example implementation of this is:
@Override public void beginParsing(){ parser.beginParsing(input); }
This is to allow for different input types such asReader, File, or InputStream
without large code reuse.
-
iterator
public final ResultIterator<T,ParsingContext> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
- Specified by:
iterator
in interfaceIterableResult<T,ParsingContext>
-
-