Package org.supercsv.io
Interface ICsvListReader
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,ICsvReader
- All Known Implementing Classes:
CsvListReader
public interface ICsvListReader extends ICsvReader
Interface for readers that read into Lists.- Author:
- Kasper B. Graversen, James Bassett
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<java.lang.Object>
executeProcessors(CellProcessor... processors)
Executes the supplied cell processors on the last row of CSV that was read.java.util.List<java.lang.String>
read()
Reads a row of a CSV file and returns a List of Strings containing each column.java.util.List<java.lang.Object>
read(CellProcessor... processors)
Reads a row of a CSV file and returns a List of Objects containing each column.-
Methods inherited from interface org.supercsv.io.ICsvReader
get, getHeader, getLineNumber, getRowNumber, getUntokenizedRow, length
-
-
-
-
Method Detail
-
read
java.util.List<java.lang.String> read() throws java.io.IOException
Reads a row of a CSV file and returns a List of Strings containing each column. If you are forced to use this method instead ofread(CellProcessor...)
because your CSV file has a variable number of columns, then you can call theexecuteProcessors(CellProcessor...)
method after callingread()
to execute the cell processors manually (after determining the number of columns read in and which cell processors to use).- Returns:
- the List of columns, or null if EOF
- Throws:
java.io.IOException
- if an I/O error occurredSuperCsvException
- if there was a general exception while reading/processing- Since:
- 1.0
-
read
java.util.List<java.lang.Object> read(CellProcessor... processors) throws java.io.IOException
Reads a row of a CSV file and returns a List of Objects containing each column. The data can be further processed by cell processors (each element in the processors array corresponds with a CSV column). A null entry in the processors array indicates no further processing is required (the unprocessed String value will be added to the List). Prior to version 2.0.0 this method returned a List of Strings.- Parameters:
processors
- an array of CellProcessors used to further process data before it is added to the List (each element in the processors array corresponds with a CSV column - the number of processors should match the number of columns). A null entry indicates no further processing is required (the unprocessed String value will be added to the List).- Returns:
- the List of columns, or null if EOF
- Throws:
java.io.IOException
- if an I/O error occurredjava.lang.NullPointerException
- if processors is nullSuperCsvConstraintViolationException
- if a CellProcessor constraint failedSuperCsvException
- if there was a general exception while reading/processing- Since:
- 1.0
-
executeProcessors
java.util.List<java.lang.Object> executeProcessors(CellProcessor... processors)
Executes the supplied cell processors on the last row of CSV that was read. This should only be used when the number of CSV columns is unknown before the row is read, and you are forced to useread()
instead ofread(CellProcessor...)
.- Parameters:
processors
- an array of CellProcessors used to further process the last row of CSV data that was read (each element in the processors array corresponds with a CSV column - the number of processors should match the number of columns). A null entry indicates no further processing is required (the unprocessed String value will be added to the List).- Returns:
- the List of processed columns
- Throws:
java.lang.NullPointerException
- if processors is nullSuperCsvConstraintViolationException
- if a CellProcessor constraint failedSuperCsvException
- if the wrong number of processors are supplied, or CellProcessor execution failed- Since:
- 2.1.0
-
-