public class CsvMapReader extends AbstractCsvReader implements ICsvMapReader
Constructor and Description |
---|
CsvMapReader(ITokenizer tokenizer,
CsvPreference preferences)
Constructs a new CsvMapReader with the supplied (custom) Tokenizer and CSV preferences.
|
CsvMapReader(Reader reader,
CsvPreference preferences)
Constructs a new CsvMapReader with the supplied Reader and CSV preferences.
|
Modifier and Type | Method and Description |
---|---|
Map<String,String> |
read(String... nameMapping)
Reads a row of a CSV file into a Map, using the supplied name mapping to map column values to the appropriate map
entries.
|
Map<String,Object> |
read(String[] nameMapping,
CellProcessor[] processors)
Reads a row of a CSV file into a Map, using the supplied name mapping to map column values to the appropriate map
entries, and the supplied processors to process the values before adding them to the Map.
|
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 CsvMapReader(Reader reader, CsvPreference preferences)
reader
- the readerpreferences
- the CSV preferencesNullPointerException
- if reader or preferences are nullpublic CsvMapReader(ITokenizer tokenizer, CsvPreference preferences)
tokenizer
- the tokenizerpreferences
- the CSV preferencesNullPointerException
- if tokenizer or preferences are nullpublic Map<String,String> read(String... nameMapping) throws IOException
read
in interface ICsvMapReader
nameMapping
- an array of Strings linking the CSV columns to their corresponding entry in the Map (the array length
should match the number of columns). A null entry in the array indicates that the column
should be ignored (e.g. not added to the Map).IOException
- if an I/O error occurredpublic Map<String,Object> read(String[] nameMapping, CellProcessor[] processors) throws IOException
read
in interface ICsvMapReader
nameMapping
- an array of Strings linking the CSV columns to their corresponding entry in the Map (the array length
should match the number of columns). A null entry in the array indicates that the column
should be ignored (e.g. not added to the Map).processors
- an array of CellProcessors used to further process data before it is added to the Map (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 added to the Map).IOException
- if an I/O error occurredCopyright © 2007–2015 Super CSV. All rights reserved.