public class DefaultParsingContext extends DefaultContext implements ParsingContext
ParsingContext implementation used internally by AbstractParser to expose information about a parsing process in execution.ParsingContext,
AbstractParser,
RowProcessor| Modifier and Type | Field and Description |
|---|---|
private CharInputReader |
input |
private AbstractParser<?> |
parser |
columnMap, errorContentLength, output, recordFactory, stopped| Constructor and Description |
|---|
DefaultParsingContext(AbstractParser<?> parser,
int errorContentLength) |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.Long,java.lang.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.
|
long |
currentLine()
Returns the current line of text being processed by the parser
|
java.lang.String |
currentParsedContent()
Returns a String with the input character sequence parsed to produce the current record.
|
int |
currentParsedContentLength()
Returns the length of the character sequence parsed to produce the current record.
|
java.lang.String |
fieldContentOnError()
Returns a String with the input character sequence accumulated on a field before
TextParsingException occurred. |
java.lang.String |
lastComment()
Returns the last comment found in the input.
|
char[] |
lineSeparator()
Returns the line separator characters used to separate individual records when parsing.
|
java.lang.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.
|
columnsReordered, currentColumn, currentRecord, errorContentLength, extractedFieldIndexes, headers, indexOf, indexOf, isStopped, recordMetaData, reset, selectedHeaders, stop, toRecordclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcolumnsReordered, extractedFieldIndexes, headerscurrentColumn, currentRecord, errorContentLength, indexOf, indexOf, isStopped, recordMetaData, selectedHeaders, stop, toRecordprivate final CharInputReader input
private final AbstractParser<?> parser
public DefaultParsingContext(AbstractParser<?> parser, int errorContentLength)
public long currentLine()
ParsingContextcurrentLine in interface ParsingContextpublic long currentChar()
ParsingContextcurrentChar in interface ParsingContextpublic void skipLines(long lines)
ParsingContextskipLines in interface ParsingContextlines - the number of lines to be skipped.public java.lang.String fieldContentOnError()
ParsingContextTextParsingException occurred.fieldContentOnError in interface ParsingContextpublic java.lang.String currentParsedContent()
ParsingContextcurrentParsedContent in interface ParsingContextpublic int currentParsedContentLength()
ParsingContextcurrentParsedContentLength in interface ParsingContextpublic java.util.Map<java.lang.Long,java.lang.String> comments()
ParsingContextCommonParserSettings.isCommentCollectionEnabled() evaluates to false.comments in interface ParsingContextpublic java.lang.String lastComment()
ParsingContextnull will be returned if CommonParserSettings.isCommentCollectionEnabled() is evaluated to false.lastComment in interface ParsingContextpublic java.lang.String[] parsedHeaders()
ParsingContextCommonParserSettings.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 ParsingContext.headers() method instead to obtain the headers actually used by the parser.parsedHeaders in interface ParsingContextCommonParserSettings.headerExtractionEnabled is true.public char[] lineSeparator()
ParsingContextFormat.getLineSeparator() configuration, or the line separator sequence
identified automatically when CommonParserSettings.isLineSeparatorDetectionEnabled() evaluates to true.lineSeparator in interface ParsingContext