public class ParsingContextWrapper extends ContextWrapper<ParsingContext> implements ParsingContext
ParsingContext
.context
Constructor and Description |
---|
ParsingContextWrapper(ParsingContext context)
Wraps a
ParsingContext . |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
int |
currentParsedContentLength()
Returns the length of the character sequence parsed to produce the current record.
|
String |
fieldContentOnError()
Returns a String with the input character sequence accumulated on a field before
TextParsingException occurred. |
String |
lastComment()
Returns the last comment found in the input.
|
char[] |
lineSeparator()
Returns the line separator characters used to separate individual records when parsing.
|
String[] |
parsedHeaders()
Returns the headers parsed from the input, if and only if
CommonParserSettings.headerExtractionEnabled is true . |
String[] |
selectedHeaders()
Returns the sequence of headers that have been selected.
|
void |
skipLines(long lines)
Skips a given number of lines from the current position.
|
Record |
toRecord(String[] row)
Converts the given parsed row to a
Record |
columnsReordered, currentColumn, currentRecord, errorContentLength, extractedFieldIndexes, headers, indexOf, indexOf, isStopped, recordMetaData, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
columnsReordered, extractedFieldIndexes, headers
currentColumn, currentRecord, errorContentLength, indexOf, indexOf, isStopped, recordMetaData, stop
public ParsingContextWrapper(ParsingContext context)
ParsingContext
.context
- the parsingContext object to be wrapped.public long currentLine()
ParsingContext
currentLine
in interface ParsingContext
public long currentChar()
ParsingContext
currentChar
in interface ParsingContext
public void skipLines(long lines)
ParsingContext
skipLines
in interface ParsingContext
lines
- the number of lines to be skipped.public String currentParsedContent()
ParsingContext
currentParsedContent
in interface ParsingContext
public int currentParsedContentLength()
ParsingContext
currentParsedContentLength
in interface ParsingContext
public Map<Long,String> comments()
ParsingContext
CommonParserSettings.isCommentCollectionEnabled()
evaluates to false
.comments
in interface ParsingContext
public String lastComment()
ParsingContext
null
will be returned if CommonParserSettings.isCommentCollectionEnabled()
is evaluated to false
.lastComment
in interface ParsingContext
public String[] parsedHeaders()
ParsingContext
CommonParserSettings.headerExtractionEnabled
is true
.
The result of this method won't return the list of headers manually set by the user in CommonSettings.getHeaders()
.
Use the ParsingContext.headers()
method instead to obtain the headers actually used by the parser.parsedHeaders
in interface ParsingContext
CommonParserSettings.headerExtractionEnabled
is true
.public char[] lineSeparator()
ParsingContext
Format.getLineSeparator()
configuration, or the line separator sequence
identified automatically when CommonParserSettings.isLineSeparatorDetectionEnabled()
evaluates to true
.lineSeparator
in interface ParsingContext
public String fieldContentOnError()
ParsingContext
TextParsingException
occurred.fieldContentOnError
in interface ParsingContext
public String[] selectedHeaders()
Context
Context.headers()
.selectedHeaders
in interface Context
selectedHeaders
in class ContextWrapper<ParsingContext>
public Record toRecord(String[] row)
Context
Record
toRecord
in interface Context
toRecord
in class ContextWrapper<ParsingContext>
row
- the row to be converted into a Record
Record
representing the given row.Copyright © 2022 Univocity Software Pty Ltd. All rights reserved.