public class CsvListReader extends AbstractCsvReader implements ICsvListReader
Constructor and Description |
---|
CsvListReader(ITokenizer tokenizer,
CsvPreference preferences)
Constructs a new CsvListReader with the supplied (custom) Tokenizer and CSV preferences.
|
CsvListReader(Reader reader,
CsvPreference preferences)
Constructs a new CsvListReader with the supplied Reader and CSV preferences.
|
Modifier and Type | Method and Description |
---|---|
List<Object> |
executeProcessors(CellProcessor... processors)
Executes the supplied cell processors on the last row of CSV that was read.
|
List<String> |
read()
Reads a row of a CSV file and returns a List of Strings containing each column.
|
List<Object> |
read(CellProcessor... processors)
Reads a row of a CSV file and returns a List of Objects containing each column.
|
close, executeProcessors, get, getColumns, getHeader, getLineNumber, getPreferences, getRowNumber, getUntokenizedRow, length, readRow
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, getHeader, getLineNumber, getRowNumber, getUntokenizedRow, length
public CsvListReader(Reader reader, CsvPreference preferences)
reader
- the readerpreferences
- the CSV preferencesNullPointerException
- if reader or preferences are nullpublic CsvListReader(ITokenizer tokenizer, CsvPreference preferences)
tokenizer
- the tokenizerpreferences
- the CSV preferencesNullPointerException
- if tokenizer or preferences are nullpublic List<String> read() throws IOException
ICsvListReader.read(CellProcessor...)
because your CSV file has a variable number of columns, then
you can call the ICsvListReader.executeProcessors(CellProcessor...)
method after calling ICsvListReader.read()
to execute the
cell processors manually (after determining the number of columns read in and which cell processors to use).read
in interface ICsvListReader
IOException
- if an I/O error occurredpublic List<Object> read(CellProcessor... processors) throws IOException
read
in interface ICsvListReader
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).IOException
- if an I/O error occurredpublic List<Object> executeProcessors(CellProcessor... processors)
ICsvListReader.read()
instead of
ICsvListReader.read(CellProcessor...)
.executeProcessors
in interface ICsvListReader
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).Copyright © 2007–2015 Super CSV. All rights reserved.