public class CsvFieldReader extends Object implements FieldReader
FieldReader for RFC4180 style CSV files.| Constructor and Description |
|---|
CsvFieldReader(Reader reader,
char fieldSeparator,
char quoteCharacter,
boolean allowLineFeed,
UnaryOperator<CharSequence> transformer)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CharSequence |
getContent()
Returns the content of the current field.
|
long |
getFieldIndex()
Returns the field index of the current field.
|
long |
getRecordIndex()
Returns the record index of the current field.
|
long |
getRecordLineNumber()
Returns the number of line where the current RECORD starts.
|
boolean |
nextField()
Advances the cursor and returns whether or not the next field exists in the current record.
|
boolean |
nextRecord()
Advances the cursor and returns whether or not the next record exists.
|
void |
rewindFields()
Rewinds the cursor to the head of the current record.
|
public CsvFieldReader(Reader reader, char fieldSeparator, char quoteCharacter, boolean allowLineFeed, UnaryOperator<CharSequence> transformer)
reader - the source text readerfieldSeparator - the field separator characterquoteCharacter - the quote characterallowLineFeed - true to allow LF in field, otherwise falsetransformer - the line content transformer (nullable)public boolean nextRecord()
throws IOException
FieldReaderFieldReader.getContent() result object.nextRecord in interface FieldReadertrue if the next record exists, otherwise falseIOException - if I/O error occurred while reading the next recordpublic boolean nextField()
throws IOException
FieldReaderFieldReader.getContent() result object.nextField in interface FieldReadertrue if the next field exists, otherwise falseIOException - if I/O error occurred while reading the next fieldpublic void rewindFields()
throws IOException
FieldReaderrewindFields in interface FieldReaderIOException - if I/O error occurred while rewinding fieldspublic CharSequence getContent()
FieldReadergetContent in interface FieldReadernull if this represents NULLpublic long getRecordLineNumber()
FieldReadergetRecordLineNumber in interface FieldReader-1 if it is not surepublic long getRecordIndex()
FieldReadergetRecordIndex in interface FieldReader-1 if it is not surepublic long getFieldIndex()
FieldReadergetFieldIndex in interface FieldReader-1 if it is not surepublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.