Interface ITokenizer

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    AbstractTokenizer, Tokenizer

    public interface ITokenizer
    extends java.io.Closeable
    The interface for tokenizers, which are responsible for reading the CSV file, line by line.
    Author:
    Kasper B. Graversen, James Bassett
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int getLineNumber()
      Gets the line number currently being tokenized (the first line is line 1).
      java.lang.String getUntokenizedRow()
      Returns the raw (untokenized) CSV row that was just read (which can potentially span multiple lines in the file).
      boolean readColumns​(java.util.List<java.lang.String> columns)
      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 Detail

      • 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

        java.lang.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​(java.util.List<java.lang.String> columns)
                     throws java.io.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:
        java.io.IOException - when an IOException occurs
        java.lang.NullPointerException - if columns is null
        SuperCsvException - on errors in parsing the input
        Since:
        2.0.0 (was previously called readStringList)