|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ParsingContext
Context information available to instances of RowProcessor
.
The ParsingContext can be used to control and to obtain information about the parsing process.
RowProcessor
,
DefaultParsingContext
Method Summary | |
---|---|
boolean |
columnsReordered()
Indicates whether selected fields (using CommonSettings.selectFields(java.lang.String...) and friends) are being reordered. |
Map<Long,String> |
comments()
Returns all comments collected by the parser so far. |
long |
currentChar()
Returns the index of the last char read from the input so far. |
int |
currentColumn()
Returns the column index of the record being processed. |
long |
currentLine()
Returns the current line of text being processed by the parser |
String |
currentParsedContent()
Returns a String with the input character sequence parsed to produce the current record. |
long |
currentRecord()
Returns the index of the last valid record parsed from the input |
int[] |
extractedFieldIndexes()
Returns the indexes of each field extracted from the input when fields are selected in the parser settings (i.e. |
String[] |
headers()
Returns the file headers that identify each parsed record. |
int |
indexOf(Enum<?> header)
Returns the position of a header (0 based). |
int |
indexOf(String header)
Returns the position of a header (0 based). |
boolean |
isStopped()
Identifies whether the parser is running. |
String |
lastComment()
Returns the last comment found in the input. |
char[] |
lineSeparator()
Returns the line separator characters used to separate individual records when parsing. |
String[] |
parsedHeaders()
Returns the headers parsed from the input, if and only if CommonParserSettings.headerExtractionEnabled is true . |
void |
skipLines(long lines)
Skips a given number of lines from the current position. |
void |
stop()
Stops the parsing process. |
Method Detail |
---|
void stop()
boolean isStopped()
long currentLine()
long currentChar()
int currentColumn()
long currentRecord()
void skipLines(long lines)
lines
- the number of lines to be skipped.String[] headers()
If the headers are extracted from the input (i.e. CommonParserSettings.isHeaderExtractionEnabled()
== true), then these values will be returned.
If no headers are extracted from the input, then the configured headers in CommonSettings.getHeaders()
will be returned.
Note that the user-provided headers will override the header list parsed from the input, if any. To obtain the
original list of headers found in the input use parsedHeaders()
CommonParserSettings
,
CommonSettings
String[] parsedHeaders()
CommonParserSettings.headerExtractionEnabled
is true
.
The result of this method won't return the list of headers manually set by the user in CommonSettings.getHeaders()
.
Use the headers()
method instead to obtain the headers actually used by the parser.
CommonParserSettings.headerExtractionEnabled
is true
.int[] extractedFieldIndexes()
CommonSettings.selectFields(java.lang.String...)
and friends).
The indexes are relative to their original position in the input.
For example, if the input has the fields "A, B, C, D", and the selected fields are "A, D", then the extracted field indexes will return [0, 3]
If no fields were selected, then this method will return null. This means all fields are being parsed.
CommonSettings
boolean columnsReordered()
CommonSettings.selectFields(java.lang.String...)
and friends) are being reordered.
If columns are reordered, each parsed record will contain values only for the selected fields, as specified by CommonParserSettings.isColumnReorderingEnabled()
CommonParserSettings
,
CommonSettings
String currentParsedContent()
int indexOf(String header)
header
- the header whose position will be returned
int indexOf(Enum<?> header)
header
- the header whose position will be returned
Map<Long,String> comments()
CommonParserSettings.isCommentCollectionEnabled()
evaluates to false
.
String lastComment()
null
will be returned if CommonParserSettings.isCommentCollectionEnabled()
is evaluated to false
.
char[] lineSeparator()
Format.getLineSeparator()
configuration, or the line separator sequence
identified automatically when CommonParserSettings.isLineSeparatorDetectionEnabled()
evaluates to true
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |