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

pack-priv Class NoopParsingContext

extends Object
implements ParsingContext
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.common.ParsingContext, com.univocity.parsers.common.Context
Imports
com.univocity.parsers.common.record.*, java.util.*

A ParsingContext implementation that does nothing.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Modifier and TypeField and Description
pack-priv static final NoopParsingContext
private RecordMetaData

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
columnsReordered()

Implements com.univocity.parsers.common.ParsingContext.columnsReordered.

Indicates whether selected fields (using CommonSettings#selectFields and friends) are being reordered.
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 int
currentColumn()

Implements com.univocity.parsers.common.Context.currentColumn.

Returns the column index of the record being processed.
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 long
currentRecord()

Implements com.univocity.parsers.common.Context.currentRecord.

Returns the index of the last valid record parsed from the input
public int
errorContentLength()

Implements com.univocity.parsers.common.Context.errorContentLength.

Returns the length limit of parsed contents appearing in exception messages when an error occurs

If 0, then no exceptions will include the content being manipulated in their attributes, and the "<omitted>" string will appear in error messages as the parsed content.

public int[]
extractedFieldIndexes()

Implements com.univocity.parsers.common.ParsingContext.extractedFieldIndexes.

Returns the indexes of each field extracted from the input when fields are selected in the parser settings (i.e. using CommonSettings#selectFields and friends).
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[]
headers()

Implements com.univocity.parsers.common.ParsingContext.headers.

Returns the file headers that identify each parsed record.
public int
indexOf(String
the header whose position will be returned
header
)

Implements com.univocity.parsers.common.Context.indexOf.

Returns the position of a header (0 based).
public int
indexOf(Enum<?>
the header whose position will be returned
header
)

Implements com.univocity.parsers.common.Context.indexOf.

Returns the position of a header (0 based).
public boolean
isStopped()

Implements com.univocity.parsers.common.Context.isStopped.

Identifies whether the parser is running.
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 RecordMetaData
recordMetaData()

Implements com.univocity.parsers.common.Context.recordMetaData.

Returns the metadata information associated with records produced by the current parsing process.
public String[]
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 void
stop()

Implements com.univocity.parsers.common.Context.stop.

Stops the parsing process.
public Record
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

instanceback to summary
pack-priv static final NoopParsingContext instance
recordMetaDataback to summary
private RecordMetaData recordMetaData

Constructor Detail

NoopParsingContextback to summary
private NoopParsingContext()

Method Detail

columnsReorderedback to summary
public boolean columnsReordered()

Implements com.univocity.parsers.common.ParsingContext.columnsReordered.

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

Indicates whether selected fields (using CommonSettings#selectFields and friends) are being reordered.

If columns are reordered, each parsed record will contain values only for the selected fields, as specified by CommonParserSettings#isColumnReorderingEnabled

Returns:boolean

true if the parsed records are being reordered by the parser, false otherwise

Annotations
@Override
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
currentColumnback to summary
public int currentColumn()

Implements com.univocity.parsers.common.Context.currentColumn.

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

Returns the column index of the record being processed.

Returns:int

the column index of the record being processed.

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

currentRecordback to summary
public long currentRecord()

Implements com.univocity.parsers.common.Context.currentRecord.

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

Returns the index of the last valid record parsed from the input

Returns:long

the index of the last valid record parsed from the input

Annotations
@Override
errorContentLengthback to summary
public int errorContentLength()

Implements com.univocity.parsers.common.Context.errorContentLength.

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

Returns the length limit of parsed contents appearing in exception messages when an error occurs

If 0, then no exceptions will include the content being manipulated in their attributes, and the "<omitted>" string will appear in error messages as the parsed content.

defaults to -1 (no limit)

.
Returns:int

the maximum length of the data content to display in exception messages

Annotations
@Override
extractedFieldIndexesback to summary
public int[] extractedFieldIndexes()

Implements com.univocity.parsers.common.ParsingContext.extractedFieldIndexes.

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

Returns the indexes of each field extracted from the input when fields are selected in the parser settings (i.e. using CommonSettings#selectFields and friends).

The indexes are relative to their original position in the input.

For example, if the input has the fields "A, B, C, D", and the selected fields are "A, D", then the extracted field indexes will return [0, 3]

If no fields were selected, then this method will return null. This means all fields are being parsed.

Returns:int[]

The indexes of each selected field; null if no fields were selected.

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
headersback to summary
public String[] headers()

Implements com.univocity.parsers.common.ParsingContext.headers.

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

Returns the file headers that identify each parsed record.

If the headers are extracted from the input (i.e. CommonParserSettings#isHeaderExtractionEnabled() == true), then these values will be returned.

If no headers are extracted from the input, then the configured headers in CommonSettings#getHeaders() will be returned. Note that the user-provided headers will override the header list parsed from the input, if any. To obtain the original list of headers found in the input use ParsingContext#parsedHeaders()

Returns:String[]

the headers used to identify each record parsed from the input.

Annotations
@Override
indexOfback to summary
public int indexOf(String header)

Implements com.univocity.parsers.common.Context.indexOf.

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

Returns the position of a header (0 based).

Parameters
header:String

the header whose position will be returned

Returns:int

the position of the given header, or -1 if it could not be found.

Annotations
@Override
indexOfback to summary
public int indexOf(Enum<?> header)

Implements com.univocity.parsers.common.Context.indexOf.

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

Returns the position of a header (0 based).

Parameters
header:Enum<?>

the header whose position will be returned

Returns:int

the position of the given header, or -1 if it could not be found.

Annotations
@Override
isStoppedback to summary
public boolean isStopped()

Implements com.univocity.parsers.common.Context.isStopped.

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

Identifies whether the parser is running.

Returns:boolean

true if the parser is stopped, false otherwise.

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
recordMetaDataback to summary
public RecordMetaData recordMetaData()

Implements com.univocity.parsers.common.Context.recordMetaData.

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

Returns the metadata information associated with records produced by the current parsing process.

Returns:RecordMetaData

the record metadata.

Annotations
@Override
selectedHeadersback to summary
public String[] 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
stopback to summary
public void stop()

Implements com.univocity.parsers.common.Context.stop.

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

Stops the parsing process. Any open resources in use by the parser are closed automatically unless CommonParserSettings#isAutoClosingEnabled() evaluates to false.

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

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