public class CsvParser extends Object implements RecordParser
| Constructor and Description |
|---|
CsvParser(InputStream stream,
String path,
CsvConfiguration config)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
endRecord()
Finalizes current record.
|
void |
fill(BooleanOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(ByteOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(DateOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(DateTimeOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(DecimalOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(DoubleOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(FloatOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(IntOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(LongOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(ShortOption option)
Reads the next cell and set the value into the target object.
|
void |
fill(StringOption option)
Reads the next cell and set the value into the target object.
|
long |
getCurrentLineNumber()
Returns the 1-origin line number where the current record is started.
|
long |
getCurrentRecordNumber()
Returns the 1-origin record number.
|
String |
getPath()
Returns the parsing target path.
|
boolean |
next()
Prepare for reading the next record.
|
public CsvParser(InputStream stream, String path, CsvConfiguration config)
stream - the source streampath - the source pathconfig - current configurationIllegalArgumentException - if some parameters were nullpublic boolean next()
throws CsvFormatException,
IOException
RecordParserRecordFormatException.next in interface RecordParsertrue if the next record exists, or otherwise falseRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the head of the next recordCsvFormatExceptionpublic String getPath()
public long getCurrentLineNumber()
CR, LF, and CRLF.public long getCurrentRecordNumber()
public void fill(BooleanOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(ByteOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(ShortOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(IntOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(LongOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(FloatOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(DoubleOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(DecimalOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(StringOption option) throws CsvFormatException, IOException
RecordParserfill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(DateOption option) throws CsvFormatException, IOException
RecordParser0, this set null to the target object.fill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void fill(DateTimeOption option) throws CsvFormatException, IOException
RecordParser0, this set null to the target object.fill in interface RecordParseroption - the target objectRecordFormatException - if the record format is something wrongIOException - if error occurred while reading the next cellCsvFormatExceptionpublic void endRecord()
throws CsvFormatException,
IOException
RecordParserendRecord in interface RecordParserRecordFormatException - if current record is wrongIOException - if failed to finalize this recordCsvFormatExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2011–2018 Asakusa Framework Team. All rights reserved.