Top Description Fields Constructors Methods
com.univocity.parsers.common

public Class ParsingContextWrapper

extends ContextWrapper<ParsingContext>
implements ParsingContext
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.common.ParsingContext, com.univocity.parsers.common.Context
Known Direct Subclasses
com.univocity.parsers.common.ParsingContextSnapshot
Imports
com.univocity.parsers.common.record.*, java.util.*

A simple a wrapper for a ParsingContext.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Inherited from com.univocity.parsers.common.ContextWrapper:
context

Constructor Summary

AccessConstructor and Description
public
ParsingContextWrapper(ParsingContext
the parsingContext object to be wrapped.
context
)

Wraps a ParsingContext.

Method Summary

Modifier and TypeMethod and Description
public Map<Long, String>
comments()

Implements com.univocity.parsers.common.ParsingContext.comments.

Returns all comments collected by the parser so far.
public long
currentChar()

Implements com.univocity.parsers.common.ParsingContext.currentChar.

Returns the index of the last char read from the input so far.
public long
currentLine()

Implements com.univocity.parsers.common.ParsingContext.currentLine.

Returns the current line of text being processed by the parser
public String
currentParsedContent()

Implements com.univocity.parsers.common.ParsingContext.currentParsedContent.

Returns a String with the input character sequence parsed to produce the current record.
public int
currentParsedContentLength()

Implements com.univocity.parsers.common.ParsingContext.currentParsedContentLength.

Returns the length of the character sequence parsed to produce the current record.
public String
fieldContentOnError()

Implements com.univocity.parsers.common.ParsingContext.fieldContentOnError.

Returns a String with the input character sequence accumulated on a field before TextParsingException occurred.
public String
lastComment()

Implements com.univocity.parsers.common.ParsingContext.lastComment.

Returns the last comment found in the input.
public char[]
lineSeparator()

Implements com.univocity.parsers.common.ParsingContext.lineSeparator.

Returns the line separator characters used to separate individual records when parsing.
public String[]
parsedHeaders()

Implements com.univocity.parsers.common.ParsingContext.parsedHeaders.

Returns the headers parsed from the input, if and only if CommonParserSettings#headerExtractionEnabled is true.
public String[]
selectedHeaders()

Overrides com.univocity.parsers.common.ContextWrapper.selectedHeaders.

Implements com.univocity.parsers.common.Context.selectedHeaders.

Returns the sequence of headers that have been selected.
public void
skipLines(long
the number of lines to be skipped.
lines
)

Implements com.univocity.parsers.common.ParsingContext.skipLines.

Skips a given number of lines from the current position.
public Record
Inherited from com.univocity.parsers.common.ContextWrapper:
columnsReorderedcurrentColumncurrentRecorderrorContentLengthextractedFieldIndexesheadersindexOfindexOfisStoppedrecordMetaDatastop

Constructor Detail

ParsingContextWrapperback to summary
public ParsingContextWrapper(ParsingContext context)

Wraps a ParsingContext.

Parameters
context:ParsingContext

the parsingContext object to be wrapped.

Method Detail

commentsback to summary
public Map<Long, String> comments()

Implements com.univocity.parsers.common.ParsingContext.comments.

Doc from com.univocity.parsers.common.ParsingContext.comments.

Returns all comments collected by the parser so far. An empty map will be returned if CommonParserSettings#isCommentCollectionEnabled() evaluates to false.

Returns:Map<Long, String>

a map containing the line numbers and comments found in each.

Annotations
@Override
currentCharback to summary
public long currentChar()

Implements com.univocity.parsers.common.ParsingContext.currentChar.

Doc from com.univocity.parsers.common.ParsingContext.currentChar.

Returns the index of the last char read from the input so far.

Returns:long

the index of the last char read from the input so far.

Annotations
@Override
currentLineback to summary
public long currentLine()

Implements com.univocity.parsers.common.ParsingContext.currentLine.

Doc from com.univocity.parsers.common.ParsingContext.currentLine.

Returns the current line of text being processed by the parser

Returns:long

current line of text being processed by the parser

Annotations
@Override
currentParsedContentback to summary
public String currentParsedContent()

Implements com.univocity.parsers.common.ParsingContext.currentParsedContent.

Doc from com.univocity.parsers.common.ParsingContext.currentParsedContent.

Returns a String with the input character sequence parsed to produce the current record.

Returns:String

the text content parsed for the current input record.

Annotations
@Override
currentParsedContentLengthback to summary
public int currentParsedContentLength()

Implements com.univocity.parsers.common.ParsingContext.currentParsedContentLength.

Doc from com.univocity.parsers.common.ParsingContext.currentParsedContentLength.

Returns the length of the character sequence parsed to produce the current record.

Returns:int

the length of the text content parsed for the current input record

Annotations
@Override
fieldContentOnErrorback to summary
public String fieldContentOnError()

Implements com.univocity.parsers.common.ParsingContext.fieldContentOnError.

Doc from com.univocity.parsers.common.ParsingContext.fieldContentOnError.

Returns a String with the input character sequence accumulated on a field before TextParsingException occurred.

Returns:String

the text content parsed for the current field of the current input record at the time of the error.

Annotations
@Override
lastCommentback to summary
public String lastComment()

Implements com.univocity.parsers.common.ParsingContext.lastComment.

Doc from com.univocity.parsers.common.ParsingContext.lastComment.

Returns the last comment found in the input. null will be returned if CommonParserSettings#isCommentCollectionEnabled() is evaluated to false.

Returns:String

the last comment found in the input.

Annotations
@Override
lineSeparatorback to summary
public char[] lineSeparator()

Implements com.univocity.parsers.common.ParsingContext.lineSeparator.

Doc from com.univocity.parsers.common.ParsingContext.lineSeparator.

Returns the line separator characters used to separate individual records when parsing. This could be the line separator defined in the Format#getLineSeparator() configuration, or the line separator sequence identified automatically when CommonParserSettings#isLineSeparatorDetectionEnabled() evaluates to true.

Returns:char[]

the line separator sequence. Might contain one or two characters.

Annotations
@Override
parsedHeadersback to summary
public String[] parsedHeaders()

Implements com.univocity.parsers.common.ParsingContext.parsedHeaders.

Doc from com.univocity.parsers.common.ParsingContext.parsedHeaders.

Returns the headers parsed from the input, if and only if CommonParserSettings#headerExtractionEnabled is true. The result of this method won't return the list of headers manually set by the user in CommonParserSettings#getHeaders(). Use the headers() method instead to obtain the headers actually used by the parser.

Returns:String[]

the headers parsed from the input, when CommonParserSettings#headerExtractionEnabled is true.

Annotations
@Override
selectedHeadersback to summary
public String[] selectedHeaders()

Overrides com.univocity.parsers.common.ContextWrapper.selectedHeaders.

Implements com.univocity.parsers.common.Context.selectedHeaders.

Doc from com.univocity.parsers.common.Context.selectedHeaders.

Returns the sequence of headers that have been selected. If no selection has been made, all available headers will be returned, producing the same output as a call to method headers().

Returns:String[]

the sequence of selected headers, or all headers if no selection has been made.

Annotations
@Override
skipLinesback to summary
public void skipLines(long lines)

Implements com.univocity.parsers.common.ParsingContext.skipLines.

Doc from com.univocity.parsers.common.ParsingContext.skipLines.

Skips a given number of lines from the current position.

Parameters
lines:long

the number of lines to be skipped.

Annotations
@Override
toRecordback to summary
public Record toRecord(String[] row)

Overrides com.univocity.parsers.common.ContextWrapper.toRecord.

Implements com.univocity.parsers.common.Context.toRecord.

Doc from com.univocity.parsers.common.Context.toRecord.

Converts the given parsed row to a com.univocity.parsers.common.record.Record

Parameters
row:String[]

the row to be converted into a com.univocity.parsers.common.record.Record

Returns:Record

a com.univocity.parsers.common.record.Record representing the given row.

Annotations
@Override