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.- Author:
- Univocity Software Pty Ltd - parsers@univocity.com
-
Field Summary
Fields inherited from class 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.longReturns the index of the last char read from the input so far.intReturns the column index of the record being processed.longReturns the current line of text being processed by the parserReturns a String with the input character sequence parsed to produce the current record.longReturns the index of the last valid record parsed from the inputReturns the last comment found in the input.Methods inherited from class ParsingContextWrapper
currentParsedContentLength, fieldContentOnError, lineSeparator, parsedHeaders, selectedHeaders, skipLines, toRecordMethods inherited from class ContextWrapper
columnsReordered, errorContentLength, extractedFieldIndexes, headers, indexOf, indexOf, isStopped, recordMetaData, stopMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Context
errorContentLength, indexOf, indexOf, isStopped, recordMetaData, stopMethods inherited from interface ParsingContext
columnsReordered, extractedFieldIndexes, headers
-
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:ParsingContextReturns the current line of text being processed by the parser- Specified by:
currentLinein interfaceParsingContext- Overrides:
currentLinein classParsingContextWrapper- Returns:
- current line of text being processed by the parser
-
currentChar
public long currentChar()Description copied from interface:ParsingContextReturns the index of the last char read from the input so far.- Specified by:
currentCharin interfaceParsingContext- Overrides:
currentCharin classParsingContextWrapper- Returns:
- the index of the last char read from the input so far.
-
comments
Description copied from interface:ParsingContextReturns all comments collected by the parser so far. An empty map will be returned ifCommonParserSettings.isCommentCollectionEnabled()evaluates tofalse.- Specified by:
commentsin interfaceParsingContext- Overrides:
commentsin classParsingContextWrapper- Returns:
- a map containing the line numbers and comments found in each.
-
lastComment
Description copied from interface:ParsingContextReturns the last comment found in the input.nullwill be returned ifCommonParserSettings.isCommentCollectionEnabled()is evaluated tofalse.- Specified by:
lastCommentin interfaceParsingContext- Overrides:
lastCommentin classParsingContextWrapper- Returns:
- the last comment found in the input.
-
currentColumn
public int currentColumn()Description copied from interface:ContextReturns the column index of the record being processed.- Specified by:
currentColumnin interfaceContext- Overrides:
currentColumnin classContextWrapper<ParsingContext>- Returns:
- the column index of the record being processed.
-
currentParsedContent
Description copied from interface:ParsingContextReturns a String with the input character sequence parsed to produce the current record.- Specified by:
currentParsedContentin interfaceParsingContext- Overrides:
currentParsedContentin classParsingContextWrapper- Returns:
- the text content parsed for the current input record.
-
currentRecord
public long currentRecord()Description copied from interface:ContextReturns the index of the last valid record parsed from the input- Specified by:
currentRecordin interfaceContext- Overrides:
currentRecordin classContextWrapper<ParsingContext>- Returns:
- the index of the last valid record parsed from the input
-