Class ParserIterator<T>

  • All Implemented Interfaces:
    IterableResult<T,​ParsingContext>, java.lang.Iterable<T>
    Direct Known Subclasses:
    RecordIterator, RowIterator

    abstract class ParserIterator<T>
    extends java.lang.Object
    implements IterableResult<T,​ParsingContext>
    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.
    • Constructor Detail

      • ParserIterator

        protected ParserIterator​(AbstractParser parser)
        Creates a ParserIterator using the provided parser
        Parameters:
        parser - the parser to iterate over
    • Method Detail

      • 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.
      • nextResult

        protected abstract T nextResult()
        Returns the next record (either a String[] or a Record)
        Returns:
        the next record if available.