|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.supercsv.io.AbstractCsvReader
org.supercsv.io.CsvMapReader
public class CsvMapReader
Map readers are capable of reading CSV files and populate map instances of a multiple types.
| Field Summary |
|---|
| Fields inherited from class org.supercsv.io.AbstractCsvReader |
|---|
line, preferences, tokenizer |
| Constructor Summary | |
|---|---|
CsvMapReader(Reader reader,
CsvPreference preferences)
Create a csv reader with a specific preference. |
|
| Method Summary | |
|---|---|
void |
close()
close the stream |
String |
get(int N)
Get column N of the current line This is useful for parsing e.g. first column and react by reading the line on the basis of that first argument |
String[] |
getCSVHeader(boolean firstLineCheck)
This method is used to get an optional header of the csv file and move the file curser to the first row containing data (the second row from the top) The header can subsequently be used as the nameMapper for read
operations. |
int |
getLineNumber()
gets the current position in the file. |
int |
length()
returns the length of the current line |
Map<String,String> |
read(String... nameMapping)
Read the line into a map using an array to define the keys which to query the data. |
Map<String,? super Object> |
read(String[] nameMapping,
CellProcessor[] processors)
Read a line into a map of any type converting the strings to types |
org.supercsv.io.ICsvReader |
setPreferences(CsvPreference preference)
Determine how the reader reads the input source. |
org.supercsv.io.ICsvReader |
setTokenizer(ITokenizer tokenizer)
Determine how the reader reads the csv file. |
| Methods inherited from class org.supercsv.io.AbstractCsvReader |
|---|
close, get, getCSVHeader, getLineNumber, length, setInput, setPreferences, setTokenizer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CsvMapReader(Reader reader,
CsvPreference preferences)
| Method Detail |
|---|
public Map<String,String> read(String... nameMapping)
throws IOException
read in interface ICsvMapReadernameMapping - defines the keys of the map, null entries denote columns to be skipped in the csv file
IOException
public Map<String,? super Object> read(String[] nameMapping,
CellProcessor[] processors)
throws IOException
read in interface ICsvMapReadernameMapping - defines the keys of the map, null entries denote columns to be skipped in the csv fileprocessors - an array of cell processors. Null values are accepted as not processing the corresponding position in the
name mapper
IOException - in case of an I/O error
public void close()
throws IOException
IOException
public String get(int N)
throws IOException,
IndexOutOfBoundsException
IOException
IndexOutOfBoundsException
public String[] getCSVHeader(boolean firstLineCheck)
throws IOException
nameMapper for read
operations.
firstLineCheck - denotes whether a check should be made to ensure only the first line of the file can represent a header
IOException - if an I/O error occurs or if the method is not called as the first read operation on a source. *public int getLineNumber()
public int length()
throws IOException
IOExceptionpublic org.supercsv.io.ICsvReader setPreferences(CsvPreference preference)
public org.supercsv.io.ICsvReader setTokenizer(ITokenizer tokenizer)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||