public class CSVReader
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CSVReader.CSVRecord
The data structure for storing the parsed rows.
|
| Constructor and Description |
|---|
CSVReader()
Constructs a new CSVReader
|
CSVReader(java.lang.String resource,
int headerLines)
Opens the given file from the root data path.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the reader.
|
java.lang.String[] |
getHeaders() |
java.util.List<CSVReader.CSVRecord> |
getRecords() |
void |
read(java.io.InputStream stream)
Reads CSV data from an input stream, parsing it into a record structure compatible
with the Apache reader.
|
java.lang.String[] |
readRecord(int fieldCount)
Reads a record from class field reader
Automatically closes the file if end-of-file or a record is read with a number of fields not equal to the input fieldCount. |
void |
trashRecord() |
public CSVReader()
public CSVReader(java.lang.String resource,
int headerLines)
resource - Path to resource.headerLines - Number of lines to skip.public void read(java.io.InputStream stream)
stream - An input stream.public java.lang.String[] readRecord(int fieldCount)
fieldCount - expected number of fields.public void trashRecord()
public java.util.List<CSVReader.CSVRecord> getRecords()
public java.lang.String[] getHeaders()
public void close()