Package com.univocity.parsers.common
Class ParsingContextSnapshot
java.lang.Object
com.univocity.parsers.common.ContextWrapper<ParsingContext>
com.univocity.parsers.common.ParsingContextWrapper
com.univocity.parsers.common.ParsingContextSnapshot
- All Implemented Interfaces:
Context
,ParsingContext
A snapshot of a
ParsingContext
which retains copies of variable attributes of a given ParsingContext
to
store the state of the parsing process at a given point in time. All runtime operations such as ContextWrapper.stop()
will still work and affect the current parsing process.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
private final int
private final long
private final String
private final long
private final String
Fields inherited from class com.univocity.parsers.common.ContextWrapper
context
-
Constructor Summary
ConstructorsConstructorDescriptionParsingContextSnapshot
(ParsingContext context) Creates a snapshot of a givenContext
-
Method Summary
Modifier and TypeMethodDescriptioncomments()
Returns all comments collected by the parser so far.long
Returns the index of the last char read from the input so far.int
Returns the column index of the record being processed.long
Returns the current line of text being processed by the parserReturns a String with the input character sequence parsed to produce the current record.long
Returns the index of the last valid record parsed from the inputReturns the last comment found in the input.Methods inherited from class com.univocity.parsers.common.ParsingContextWrapper
currentParsedContentLength, fieldContentOnError, lineSeparator, parsedHeaders, selectedHeaders, skipLines, toRecord
Methods inherited from class com.univocity.parsers.common.ContextWrapper
columnsReordered, errorContentLength, extractedFieldIndexes, headers, indexOf, indexOf, isStopped, recordMetaData, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.univocity.parsers.common.Context
errorContentLength, indexOf, indexOf, isStopped, recordMetaData, stop
Methods inherited from interface com.univocity.parsers.common.ParsingContext
columnsReordered, extractedFieldIndexes, headers
-
Field Details
-
currentLine
private final long currentLine -
currentChar
private final long currentChar -
comments
-
lastComment
-
currentColumn
private final int currentColumn -
currentParsedContent
-
currentRecord
private final long currentRecord
-
-
Constructor Details
-
ParsingContextSnapshot
Creates a snapshot of a givenContext
- Parameters:
context
- the context object whose variable attributes will be copied over.
-
-
Method Details
-
currentLine
public long currentLine()Description copied from interface:ParsingContext
Returns the current line of text being processed by the parser- Specified by:
currentLine
in interfaceParsingContext
- Overrides:
currentLine
in classParsingContextWrapper
- Returns:
- current line of text being processed by the parser
-
currentChar
public long currentChar()Description copied from interface:ParsingContext
Returns the index of the last char read from the input so far.- Specified by:
currentChar
in interfaceParsingContext
- Overrides:
currentChar
in classParsingContextWrapper
- Returns:
- the index of the last char read from the input so far.
-
comments
Description copied from interface:ParsingContext
Returns all comments collected by the parser so far. An empty map will be returned ifCommonParserSettings.isCommentCollectionEnabled()
evaluates tofalse
.- Specified by:
comments
in interfaceParsingContext
- Overrides:
comments
in classParsingContextWrapper
- Returns:
- a map containing the line numbers and comments found in each.
-
lastComment
Description copied from interface:ParsingContext
Returns the last comment found in the input.null
will be returned ifCommonParserSettings.isCommentCollectionEnabled()
is evaluated tofalse
.- Specified by:
lastComment
in interfaceParsingContext
- Overrides:
lastComment
in classParsingContextWrapper
- Returns:
- the last comment found in the input.
-
currentColumn
public int currentColumn()Description copied from interface:Context
Returns the column index of the record being processed.- Specified by:
currentColumn
in interfaceContext
- Overrides:
currentColumn
in classContextWrapper<ParsingContext>
- Returns:
- the column index of the record being processed.
-
currentParsedContent
Description copied from interface:ParsingContext
Returns a String with the input character sequence parsed to produce the current record.- Specified by:
currentParsedContent
in interfaceParsingContext
- Overrides:
currentParsedContent
in classParsingContextWrapper
- Returns:
- the text content parsed for the current input record.
-
currentRecord
public long currentRecord()Description copied from interface:Context
Returns the index of the last valid record parsed from the input- Specified by:
currentRecord
in interfaceContext
- Overrides:
currentRecord
in classContextWrapper<ParsingContext>
- Returns:
- the index of the last valid record parsed from the input
-