Top Description Methods
com.univocity.parsers.common

public Interface Context

Known Direct Subinterfaces
com.univocity.parsers.common.ParsingContext
Known Direct Implementers
com.univocity.parsers.common.ContextWrapper, com.univocity.parsers.common.DefaultContext
Imports
com.univocity.parsers.common.record.*

Basic context information used internally by instances of com.univocity.parsers.common.processor.core.Processor and com.univocity.parsers.common.record.Record.
Author
Univocity Software Pty Ltd - [email protected]
See Also
DefaultContext, ParsingContext, DefaultParsingContext

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

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

Indicates whether selected fields are being reordered.

public int

Returns:

the column index of the record being processed.
currentColumn
()

Returns the column index of the record being processed.

public long

Returns:

the index of the last valid record parsed from the input
currentRecord
()

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

public int

Returns:

the maximum length of the data content to display in exception messages
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[]

Returns:

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

Returns the indexes of each field extracted from the input when fields are selected.

public String[]

Returns:

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

Returns the file headers that identify each parsed record.

public int

Returns:

the position of the given header, or -1 if it could not be found.
indexOf
(String
the header whose position will be returned
header
)

Returns the position of a header (0 based).

public int

Returns:

the position of the given header, or -1 if it could not be found.
indexOf
(Enum<?>
the header whose position will be returned
header
)

Returns the position of a header (0 based).

public boolean

Returns:

true if the parser is stopped, false otherwise.
isStopped
()

Identifies whether the parser is running.

public RecordMetaData

Returns:

the record metadata.
recordMetaData
()

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

public String[]

Returns:

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

Returns the sequence of headers that have been selected.

public void
stop()

Stops the parsing process.

public Record

Returns:

a com.univocity.parsers.common.record.Record representing the given row.
toRecord
(String[]
the row to be converted into a com.univocity.parsers.common.record.Record
row
)

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

Method Detail

columnsReorderedback to summary
public boolean columnsReordered()

Indicates whether selected fields are being reordered.

If columns are reordered, each parsed record will contain values only for the selected fields, as specified by extractedFieldIndexes()

Returns:boolean

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

See Also
com.univocity.parsers.common.CommonParserSettings, com.univocity.parsers.common.CommonSettings
currentColumnback to summary
public int currentColumn()

Returns the column index of the record being processed.

Returns:int

the column index of the record being processed.

currentRecordback to summary
public long 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

errorContentLengthback to summary
public int 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

extractedFieldIndexesback to summary
public int[] extractedFieldIndexes()

Returns the indexes of each field extracted from the input when fields are selected.

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.

See Also
com.univocity.parsers.common.CommonSettings
headersback to summary
public String[] headers()

Returns the file headers that identify each parsed record.

Returns:String[]

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

indexOfback to summary
public int indexOf(String header)

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.

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

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.

isStoppedback to summary
public boolean isStopped()

Identifies whether the parser is running.

Returns:boolean

true if the parser is stopped, false otherwise.

recordMetaDataback to summary
public RecordMetaData recordMetaData()

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

Returns:RecordMetaData

the record metadata.

selectedHeadersback to summary
public String[] 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.

stopback to summary
public void stop()

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

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

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.