Implementations highly affect the behavior of the CsvReader. With great power comes great responsibility.
Don't mess up the CSV reading process!
Even if you need custom handling, you typically don't need to extend this class directly.
Check out AbstractBaseCsvCallbackHandler first.
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract void | addField(char[]
the internal buffer that contains the field value (among other data) buf, int the offset of the field value in the buffer offset, int the length of the field value len, boolean true if the field was quotedCalled for each field in the record. |
| protected abstract void | beginRecord(long
the line number where the record starts (starting with 1) startingLineNumber)Called at the beginning of each record. |
| protected abstract T | Returns: the record ornull if the record should be ignored/skipped as it is consumed by the callback handler.Called at the end of each CSV record to build the actual record representation. |
| protected abstract int | Returns: the number of fields in the recordReturns the number of fields in the record. |
| protected abstract RecordType | Returns: the type of the record that is built from the CSV dataReturns the type of the record that is built from the CSV data. |
| protected abstract void | setComment(char[]
the internal buffer that contains the field value (among other data) buf, int the offset of the field value in the buffer offset, int the length of the field value len)Called for each comment line. |
| protected abstract void | |
| protected void |
| CsvCallbackHandler | back to summary |
|---|---|
| protected CsvCallbackHandler() Default constructor. | |
| addField | back to summary |
|---|---|
| protected abstract void addField(char[] buf, int offset, int len, boolean quoted) Called for each field in the record. A record can either be a comment or a regular record. If this method is called, the record is a regular record and cannot be a comment. The The
| |
| beginRecord | back to summary |
|---|---|
| protected abstract void beginRecord(long startingLineNumber) Called at the beginning of each record. The
| |
| buildRecord | back to summary |
|---|---|
| protected abstract T buildRecord() Called at the end of each CSV record to build the actual record representation.
| |
| getFieldCount | back to summary |
|---|---|
| protected abstract int getFieldCount() Returns the number of fields in the record. The
| |
| getRecordType | back to summary |
|---|---|
| protected abstract RecordType getRecordType() Returns the type of the record that is built from the CSV data. The
| |
| setComment | back to summary |
|---|---|
| protected abstract void setComment(char[] buf, int offset, int len) Called for each comment line. Note that the comment character is not included in the value. This method is not called if
There can only be one invocation of this method per record. A record can either be a comment or a regular record. If this method is called, the record is a comment and cannot be a regular record. The
| |
| setEmpty | back to summary |
|---|---|
| protected abstract void setEmpty() Called for each empty line. | |
| terminate | back to summary |
|---|---|
| protected void terminate() Called at the end of the CSV reading process. | |