Package com.univocity.parsers.common
Interface Context
-
- All Known Subinterfaces:
ParsingContext
- All Known Implementing Classes:
ContextSnapshot
,ContextWrapper
,DefaultContext
,DefaultParsingContext
,NoopParsingContext
,ParsingContextSnapshot
,ParsingContextWrapper
public interface Context
- See Also:
DefaultContext
,ParsingContext
,DefaultParsingContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
columnsReordered()
Indicates whether selected fields are being reordered.int
currentColumn()
Returns the column index of the record being processed.long
currentRecord()
Returns the index of the last valid record parsed from the inputint
errorContentLength()
Returns the length limit of parsed contents appearing in exception messages when an error occursint[]
extractedFieldIndexes()
Returns the indexes of each field extracted from the input when fields are selected.java.lang.String[]
headers()
Returns the file headers that identify each parsed record.int
indexOf(java.lang.Enum<?> header)
Returns the position of a header (0 based).int
indexOf(java.lang.String header)
Returns the position of a header (0 based).boolean
isStopped()
Identifies whether the parser is running.RecordMetaData
recordMetaData()
Returns the metadata information associated with records produced by the current parsing process.java.lang.String[]
selectedHeaders()
Returns the sequence of headers that have been selected.void
stop()
Stops the parsing process.Record
toRecord(java.lang.String[] row)
Converts the given parsed row to aRecord
-
-
-
Method Detail
-
headers
java.lang.String[] headers()
Returns the file headers that identify each parsed record.- Returns:
- the headers used to identify each record parsed from the input.
-
selectedHeaders
java.lang.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 methodheaders()
.- Returns:
- the sequence of selected headers, or all headers if no selection has been made.
-
extractedFieldIndexes
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:
- The indexes of each selected field; null if no fields were selected.
- See Also:
CommonSettings
-
columnsReordered
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:
- true if the parsed records are being reordered by the parser, false otherwise
- See Also:
CommonParserSettings
,CommonSettings
-
indexOf
int indexOf(java.lang.String header)
Returns the position of a header (0 based).- Parameters:
header
- the header whose position will be returned- Returns:
- the position of the given header, or -1 if it could not be found.
-
indexOf
int indexOf(java.lang.Enum<?> header)
Returns the position of a header (0 based).- Parameters:
header
- the header whose position will be returned- Returns:
- the position of the given header, or -1 if it could not be found.
-
currentColumn
int currentColumn()
Returns the column index of the record being processed.- Returns:
- the column index of the record being processed.
-
currentRecord
long currentRecord()
Returns the index of the last valid record parsed from the input- Returns:
- the index of the last valid record parsed from the input
-
stop
void stop()
Stops the parsing process. Any open resources in use by the parser are closed automatically unlessCommonParserSettings.isAutoClosingEnabled()
evaluates tofalse
.
-
isStopped
boolean isStopped()
Identifies whether the parser is running.- Returns:
- true if the parser is stopped, false otherwise.
-
errorContentLength
int errorContentLength()
Returns the length limit of parsed contents appearing in exception messages when an error occursIf
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:
- the maximum length of the data content to display in exception messages
-
recordMetaData
RecordMetaData recordMetaData()
Returns the metadata information associated with records produced by the current parsing process.- Returns:
- the record metadata.
-
-