Interface ITokenizer

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AbstractTokenizer, Tokenizer

public interface ITokenizer extends Closeable
The interface for tokenizers, which are responsible for reading the CSV file, line by line.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the line number currently being tokenized (the first line is line 1).
    Returns the raw (untokenized) CSV row that was just read (which can potentially span multiple lines in the file).
    boolean
    Reads a CSV row into the supplied List of columns (which can potentially span multiple lines in the file).

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • getLineNumber

      int getLineNumber()
      Gets the line number currently being tokenized (the first line is line 1). This number increments at every line terminator as the data is read, i.e. it will be
      • 0, if readColumns(List) hasn't been called yet
      • 1, when the first line is being read/tokenized
      • 2, when the second line is being read/tokenized
      Returns:
      the line number currently being tokenized
    • getUntokenizedRow

      String getUntokenizedRow()
      Returns the raw (untokenized) CSV row that was just read (which can potentially span multiple lines in the file).
      Returns:
      the raw (untokenized) CSV row that was just read
      Since:
      2.0.0
    • readColumns

      boolean readColumns(List<String> columns) throws IOException
      Reads a CSV row into the supplied List of columns (which can potentially span multiple lines in the file). The columns list is cleared as the first operation in the method. Any empty columns ("") will be added to the list as null.
      Parameters:
      columns - the List of columns to read into
      Returns:
      true if something was read, or false if EOF
      Throws:
      IOException - when an IOException occurs
      NullPointerException - if columns is null
      SuperCsvException - on errors in parsing the input
      Since:
      2.0.0 (was previously called readStringList)