java.lang.Object
org.csveed.row.RowReaderImpl
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionRowReaderImpl(Reader reader) Instantiates a new row reader impl.RowReaderImpl(Reader reader, RowInstructions instructionsInterface) Instantiates a new row reader impl. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the line from which the row was read.Returns the header of the CSV file.intGets the max number of columns.The set of instructions for dealing with rows.booleanStates whether the Reader is done with the file.protected voidLog settings.protected LineRead bare line.Returns the first readable line of the CSV file as header, regardless if useHeader==true.readRow()Reads a single row from the file and returns this.readRows()Reads all rows from the file and returns them as a List.
-
Constructor Details
-
RowReaderImpl
Instantiates a new row reader impl.- Parameters:
reader- the reader
-
RowReaderImpl
Instantiates a new row reader impl.- Parameters:
reader- the readerinstructionsInterface- the instructions interface
-
-
Method Details
-
readRows
Description copied from interface:RowReaderReads all rows from the file and returns them as a List. After this, the RowReader will be finished -
readRow
Description copied from interface:RowReaderReads a single row from the file and returns this. The RowReader will keep track of its state. -
getCurrentLine
public int getCurrentLine()Description copied from interface:RowReaderReturns 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:
getCurrentLinein interfaceRowReader- Returns:
- current line number
-
getHeader
Description copied from interface:RowReaderReturns the header of the CSV file. Only possibly returns a value when useHeader==true -
getMaxNumberOfColumns
public int getMaxNumberOfColumns()Gets the max number of columns.- Returns:
- the max number of columns
-
readHeader
Description copied from interface:RowReaderReturns the first readable line of the CSV file as header, regardless if useHeader==true.- Specified by:
readHeaderin interfaceRowReader- Returns:
- header
-
isFinished
public boolean isFinished()Description copied from interface:RowReaderStates whether the Reader is done with the file.- Specified by:
isFinishedin interfaceRowReader- Returns:
- true if file is finished
-
logSettings
protected void logSettings()Log settings. -
readBareLine
Read bare line.- Returns:
- the line
-
getRowInstructions
Description copied from interface:RowReaderThe set of instructions for dealing with rows.- Specified by:
getRowInstructionsin interfaceRowReader- Returns:
- row instructions
-