Class 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.
    Author:
    Robert Bor
    • Constructor Detail

      • RowReaderImpl

        public RowReaderImpl​(Reader reader)
    • Method Detail

      • 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()
      • 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()
      • readBareLine

        protected Line readBareLine()