|
BeanIO 2.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.beanio.stream.csv.CsvReader
public class CsvReader
A CsvReader is used to parse CSV formatted flat files into records of String arrays.
The CSV format supported is defined by specification RFC 4180. By default, there is one exception: lines that span multiple records will throw an exception. To allow quoted multi-line fields, simply set multilineEnabled to true when constructing the reader.
The reader also supports the following customizations:
The reader will not recognize an escape character used outside of a quoted field.
| Constructor Summary | |
|---|---|
CsvReader(Reader in)
Constructs a new CsvReader. |
|
CsvReader(Reader in,
CsvParserConfiguration config)
Constructs a new CsvReader. |
|
| Method Summary | |
|---|---|
void |
close()
Closes this input stream. |
int |
getRecordLineNumber()
Returns the starting line number of the last record record. |
String |
getRecordText()
Returns the raw text of the last record read or null if the end of the stream was reached. |
String[] |
read()
Reads the next record from this input stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CsvReader(Reader in)
in - the input stream to read from
public CsvReader(Reader in,
CsvParserConfiguration config)
throws IllegalArgumentException
in - the input stream to read fromconfig - the reader configuration settings or null to accept defaults
IllegalArgumentException - if a configuration setting is invalid| Method Detail |
|---|
public int getRecordLineNumber()
getRecordLineNumber in interface RecordReaderpublic String getRecordText()
getRecordText in interface RecordReader
public String[] read()
throws IOException,
RecordIOException
read in interface RecordReaderIOException - if an I/O error occurs
RecordIOException - if the record is malformed and cannot
be parsed, but subsequent reads may still be possible
public void close()
throws IOException
RecordReader
close in interface RecordReaderIOException - if an I/O error occurs closing the stream
|
BeanIO 2.0.4 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||