com.univocity.parsers.common.iterators
Class RecordIterator

java.lang.Object
  extended by com.univocity.parsers.common.iterators.RecordIterator
All Implemented Interfaces:
IterableResult<Record,ParsingContext>, Iterable<Record>

public abstract class RecordIterator
extends Object

An iterator of Records. Created when AbstractParser.iterateRecords(File) (and its overloaded counterparts) is called

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Field Summary
protected  AbstractParser parser
           
 
Constructor Summary
RecordIterator(AbstractParser parser)
           
 
Method Summary
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  Record nextResult()
          Returns the next record (either a String[] or a Record)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 a Record)

Returns:
the next record if available.

getContext

public final ParsingContext getContext()
Description copied from interface: IterableResult
Returns the current parsing Context, if available

Specified by:
getContext in interface IterableResult<T,ParsingContext>
Returns:
the contextual object with information about an ongoing parsing process

beginParsing

protected abstract void beginParsing()
This method is called whenever the iterator is starting to iterate over the results. an example implementation of this is:
     &#064;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.


iterator

public final ResultIterator<T,ParsingContext> iterator()
Specified by:
iterator in interface IterableResult<T,ParsingContext>
Specified by:
iterator in interface Iterable<T>


Copyright © 2017 uniVocity Software Pty Ltd. All rights reserved.