Class RowReaderImpl

java.lang.Object
org.csveed.row.RowReaderImpl
All Implemented Interfaces:
RowReader

public class RowReaderImpl extends Object implements RowReader
Builds up a List of cells (String) per read row. Note that this class is stateful, so it can support a per-row parse approach as well.
  • Constructor Details

    • RowReaderImpl

      public RowReaderImpl(Reader reader)
      Instantiates a new row reader impl.
      Parameters:
      reader - the reader
    • RowReaderImpl

      public RowReaderImpl(Reader reader, RowInstructions instructionsInterface)
      Instantiates a new row reader impl.
      Parameters:
      reader - the reader
      instructionsInterface - the instructions interface
  • Method Details

    • readRows

      public List<Row> readRows()
      Description copied from interface: RowReader
      Reads all rows from the file and returns them as a List. After this, the RowReader will be finished
      Specified by:
      readRows in interface RowReader
      Returns:
      all Rows read from the Reader
    • readRow

      public Row readRow()
      Description copied from interface: RowReader
      Reads a single row from the file and returns this. The RowReader will keep track of its state.
      Specified by:
      readRow in interface RowReader
      Returns:
      Row read from the Reader
    • getCurrentLine

      public int getCurrentLine()
      Description copied from interface: RowReader
      Returns the line from which the row was read. Note that a line is seen as a legitimate CSV row, not necessarily a printable line (unless multi-lines are used, these values are the same).
      Specified by:
      getCurrentLine in interface RowReader
      Returns:
      current line number
    • getHeader

      public Header getHeader()
      Description copied from interface: RowReader
      Returns the header of the CSV file. Only possibly returns a value when useHeader==true
      Specified by:
      getHeader in interface RowReader
      Returns:
      header or null if the useHeader==false
    • getMaxNumberOfColumns

      public int getMaxNumberOfColumns()
      Gets the max number of columns.
      Returns:
      the max number of columns
    • readHeader

      public Header readHeader()
      Description copied from interface: RowReader
      Returns the first readable line of the CSV file as header, regardless if useHeader==true.
      Specified by:
      readHeader in interface RowReader
      Returns:
      header
    • isFinished

      public boolean isFinished()
      Description copied from interface: RowReader
      States whether the Reader is done with the file.
      Specified by:
      isFinished in interface RowReader
      Returns:
      true if file is finished
    • logSettings

      protected void logSettings()
      Log settings.
    • readBareLine

      protected Line readBareLine()
      Read bare line.
      Returns:
      the line
    • getRowInstructions

      public RowInstructions getRowInstructions()
      Description copied from interface: RowReader
      The set of instructions for dealing with rows.
      Specified by:
      getRowInstructions in interface RowReader
      Returns:
      row instructions