Top Description Fields Constructors Methods
com.univocity.parsers.common.iterators

pack-priv abstract Class ParserIterator<T>

extends Object
implements IterableResult<T, ParsingContext>
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.common.IterableResult, java.lang.Iterable
Known Direct Subclasses
com.univocity.parsers.common.iterators.RecordIterator, com.univocity.parsers.common.iterators.RowIterator
Imports
com.univocity.parsers.common.*, com.univocity.parsers.common.record.*, java.util.*

An 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.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Modifier and TypeField and Description
protected final AbstractParser<T extends CommonParserSettings<?>>

Constructor Summary

AccessConstructor and Description
protected
ParserIterator(AbstractParser<T extends CommonParserSettings<?>>
the parser to iterate over
parser
)

Creates a ParserIterator using the provided parser

Method Summary

Modifier and TypeMethod and Description
protected abstract void
beginParsing()

This method is called whenever the iterator is starting to iterate over the results.

public final ParsingContext
getContext()

Implements com.univocity.parsers.common.IterableResult.getContext.

Returns the current parsing Context, if available
public final ResultIterator<T, ParsingContext>
iterator()

Implements com.univocity.parsers.common.IterableResult.iterator.

Returns an iterator over elements of type T.
protected abstract T

Returns:

the next record if available.
nextResult
()

Returns the next record (either a String[] or a Record)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

parserback to summary
protected final AbstractParser<T extends CommonParserSettings<?>> parser

Constructor Detail

ParserIteratorback to summary
protected ParserIterator(AbstractParser<T extends CommonParserSettings<?>> parser)

Creates a ParserIterator using the provided parser

Parameters
parser:AbstractParser<T extends CommonParserSettings<?>>

the parser to iterate over

Method Detail

beginParsingback to summary
protected abstract void beginParsing()

This method is called whenever the iterator 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 as Reader, File, or InputStream without large code reuse.
getContextback to summary
public final ParsingContext getContext()

Implements com.univocity.parsers.common.IterableResult.getContext.

Doc from com.univocity.parsers.common.IterableResult.getContext.

Returns the current parsing Context, if available

Returns:ParsingContext

the contextual object with information about an ongoing parsing process

Annotations
@Override
iteratorback to summary
public final ResultIterator<T, ParsingContext> iterator()

Implements com.univocity.parsers.common.IterableResult.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:ResultIterator<T, ParsingContext>

an Iterator.

Annotations
@Override
nextResultback to summary
protected abstract T nextResult()

Returns the next record (either a String[] or a Record)

Returns:T

the next record if available.