com.univocity.parsers.common
Class ParsingContextSnapshot

java.lang.Object
  extended by com.univocity.parsers.common.ContextWrapper<ParsingContext>
      extended by com.univocity.parsers.common.ParsingContextWrapper
          extended by com.univocity.parsers.common.ParsingContextSnapshot
All Implemented Interfaces:
Context, ParsingContext

public class ParsingContextSnapshot
extends ParsingContextWrapper

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 com.univocity.parsers.common.ContextWrapper
context
 
Constructor Summary
ParsingContextSnapshot(ParsingContext context)
          Creates a snapshot of a given Context
 
Method Summary
 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
 String lastComment()
          Returns the last comment found in the input.
 
Methods inherited from class com.univocity.parsers.common.ParsingContextWrapper
fieldContentOnError, lineSeparator, parsedHeaders, selectedHeaders, skipLines
 
Methods inherited from class com.univocity.parsers.common.ContextWrapper
columnsReordered, extractedFieldIndexes, headers, indexOf, indexOf, isStopped, 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.ParsingContext
columnsReordered, extractedFieldIndexes, headers
 
Methods inherited from interface com.univocity.parsers.common.Context
indexOf, indexOf, isStopped, stop
 

Constructor Detail

ParsingContextSnapshot

public ParsingContextSnapshot(ParsingContext context)
Creates a snapshot of a given Context

Parameters:
context - the context object whose variable attributes will be copied over.
Method Detail

currentLine

public long currentLine()
Description copied from interface: ParsingContext
Returns the current line of text being processed by the parser

Specified by:
currentLine in interface ParsingContext
Overrides:
currentLine in class ParsingContextWrapper
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 interface ParsingContext
Overrides:
currentChar in class ParsingContextWrapper
Returns:
the index of the last char read from the input so far.

comments

public Map<Long,String> comments()
Description copied from interface: ParsingContext
Returns all comments collected by the parser so far. An empty map will be returned if CommonParserSettings.isCommentCollectionEnabled() evaluates to false.

Specified by:
comments in interface ParsingContext
Overrides:
comments in class ParsingContextWrapper
Returns:
a map containing the line numbers and comments found in each.

lastComment

public String lastComment()
Description copied from interface: ParsingContext
Returns the last comment found in the input. null will be returned if CommonParserSettings.isCommentCollectionEnabled() is evaluated to false.

Specified by:
lastComment in interface ParsingContext
Overrides:
lastComment in class ParsingContextWrapper
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 interface Context
Overrides:
currentColumn in class ContextWrapper<ParsingContext>
Returns:
the column index of the record being processed.

currentParsedContent

public String currentParsedContent()
Description copied from interface: ParsingContext
Returns a String with the input character sequence parsed to produce the current record.

Specified by:
currentParsedContent in interface ParsingContext
Overrides:
currentParsedContent in class ParsingContextWrapper
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 interface Context
Overrides:
currentRecord in class ContextWrapper<ParsingContext>
Returns:
the index of the last valid record parsed from the input


Copyright © 2016 uniVocity Software Pty Ltd. All rights reserved.