Class CsvParser.NormalizingIterator

java.lang.Object
com.saxonica.functions.qt4.csv.CsvParser.NormalizingIterator
All Implemented Interfaces:
PositiveIntIterator
Enclosing class:
CsvParser

public static class CsvParser.NormalizingIterator extends Object implements PositiveIntIterator
Codepoint iterator that provides the following services: (a) reading ahead, making the current and next codepoints available to the caller; (b) normalizing CR and CRLF line endings to a single LF:; (c) maintaining line number and column number.
  • Constructor Details

    • NormalizingIterator

      public NormalizingIterator(PositiveIntIterator baseIterator)
      Create an iterator that provides a single-item lookahead relative to a supplied iterator
      Parameters:
      baseIterator - the supplied iterator. A lookahead value of -1 indicates the end of the stream, so the base iterator should not return -1 as an ordinary result.
  • Method Details

    • next

      public int next()
      Return the next integer in the sequence.
      Specified by:
      next in interface PositiveIntIterator
      Returns:
      the next integer in the sequence
    • current

      public int current()
      Get the integer that has been most recently read
      Returns:
      the integer most recently returned by the next() method
    • peekAhead

      public int peekAhead()
      Return the next integer that will be read, without advancing the position
      Returns:
      the next integer in the stream, or -1 if there are no more to come.
    • getLineNumber

      public int getLineNumber()
      Get the current line number
      Returns:
      the line number (starting at 1 for characters before the first newline)
    • getColumnNumber

      public int getColumnNumber()
      Get the current column number
      Returns:
      the column number (starting at 1 for the first character on a line)