AbstractParser.
This interface declares basic functionalities to provide a common input manipulation structure for all parser classes.
Implementations of this interface MUST convert the sequence of newline characters defined by Format#getLineSeparator() into the normalized newline character provided in Format#getNormalizedNewline().
com.univocity.parsers.common.Format
| Modifier and Type | Method and Description |
|---|---|
| public long | Returns: the number of characters returned byCharInputReader#nextChar()Returns the number of characters returned by |
| public String | Returns: the text content parsed for the current input record.Returns a String with the input character sequence parsed to produce the current record. |
| public int | Returns: the length of the text content parsed for the current input recordReturns the length of the character sequence parsed to produce the current record. |
| public void | enableNormalizeLineEndings(boolean
flag indicating that the parser is escaping values and line separators are to be returned as-is. escaping)Indicates to the input reader that the parser is running in "escape" mode and new lines should be returned as-is to prevent modifying the content of the parsed value. |
| public char | Returns: the last character returned by thenextChar() method.'\0' if there are no more characters in the input or if the CharInputReader was stopped.Redeclares com. nextChar() method.
|
| public char[] | Returns: the line separator in use.Returns the line separator by this character input reader. |
| public String | Returns: theString found on the input, or null if the buffer needs to reloaded or the maximum length has been exceeded.the quote character quote, char the quote escape character escape, char the escape of the quote escape character escapeEscape, int the maximum length of the maxLength, char String to be returned. If the length exceeds this limit, null will be returnedthe first stop character that identifies the end of the content to be collected stop1, char the second stop character that identifies the end of the content to be collected stop2, boolean flag to indicate the quotes that wrap the resulting keepQuotes, boolean String should be kept.flag to indicate that escape sequences should be kept keepEscape, boolean flag to indicate leading whitespaces should be trimmed trimLeading, boolean flag to indicate that trailing whitespaces should be trimmed trimTrailing)Attempts to collect a quoted |
| public String | Returns: theString found on the input, or null if the buffer needs to reloaded or the maximum length has been exceeded.the current character to be considered. If equal to the stop character the ch, char nullValue will be returnedthe stop character that identifies the end of the content to be collected stop, boolean flag indicating whether or not trailing whitespaces should be discarded trim, String value to return when the length of the content to be returned is nullValue, int 0.the maximum length of the maxLength)String to be returned. If the length exceeds this limit, null will be returnedAttempts to collect a |
| public int | Returns: the last position of the given character in the current parsed content, or-1 if not found.the character to look for ch)Returns the last index of a given character in the current parsed content |
| public long | |
| public void | markRecordStart()
Marks the start of a new record in the input, used internally to calculate the result of |
| public char | Returns: the next character in the input. '\0' if there are no more characters in the input or if the CharInputReader was stopped.Redeclares com. java..
|
| public String | Returns: the text found in the comment from the current position.Collects the comment line found on the input. |
| public void | skipLines(long
the number of lines to skip from the current location in the input lineCount)Skips characters in the input until the given number of lines is discarded. |
| public boolean | Returns: true if an entire String value was found on the input and skipped, or false if the buffer needs to reloaded.the quote character quote, char the quote escape character escape, char the first stop character that identifies the end of the content to be collected stop1, char the second stop character that identifies the end of the content to be collected stop2)Attempts to skip a quoted |
| public boolean | Returns: true if an entire String value was found on the input and skipped, or false if the buffer needs to reloaded.the current character to be considered. If equal to the stop character ch, char false will be returnedthe stop character that identifies the end of the content to be collected stop)Attempts to skip a |
| public char | Returns: the first non-whitespace character (or delimiter) found in the input.the current character of the input current, char the first stop character (which can be a whitespace) stopChar1, char the second character (which can be a whitespace) stopChar2)Skips characters from the current input position, until a non-whitespace character, or a stop character is found |
| public void | start(Reader
A reader)java. that provides access to the input.Initializes the CharInputReader implementation with a |
| public void | stop()
Stops the CharInputReader from reading characters from the |
| charCount | back to summary |
|---|---|
| public long charCount() Returns the number of characters returned by
| |
| currentParsedContent | back to summary |
|---|---|
| public String currentParsedContent() Returns a String with the input character sequence parsed to produce the current record.
| |
| currentParsedContentLength | back to summary |
|---|---|
| public int currentParsedContentLength() Returns the length of the character sequence parsed to produce the current record.
| |
| enableNormalizeLineEndings | back to summary |
|---|---|
| public void enableNormalizeLineEndings(boolean escaping) Indicates to the input reader that the parser is running in "escape" mode and new lines should be returned as-is to prevent modifying the content of the parsed value.
| |
| getChar | back to summary |
|---|---|
| public char getChar() Redeclares com. Returns the last character returned by the
| |
| getLineSeparator | back to summary |
|---|---|
| public char[] getLineSeparator() Returns the line separator by this character input reader. This could be the line separator defined
in the
| |
| getQuotedString | back to summary |
|---|---|
| public String getQuotedString(char quote, char escape, char escapeEscape, int maxLength, char stop1, char stop2, boolean keepQuotes, boolean keepEscape, boolean trimLeading, boolean trimTrailing) Attempts to collect a quoted
| |
| getString | back to summary |
|---|---|
| public String getString(char ch, char stop, boolean trim, String nullValue, int maxLength) Attempts to collect a
| |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(char ch) Returns the last index of a given character in the current parsed content
| |
| lineCount | back to summary |
|---|---|
| public long lineCount() Returns the number of newlines read so far.
| |
| markRecordStart | back to summary |
|---|---|
| public void markRecordStart() Marks the start of a new record in the input, used internally to calculate the result of | |
| nextChar | back to summary |
|---|---|
| public char nextChar() Redeclares com. Returns the next character in the input provided by the active If the input contains a sequence of newline characters (defined by A subsequent call to this method will return the character after the newline sequence.
| |
| readComment | back to summary |
|---|---|
| public String readComment() Collects the comment line found on the input.
| |
| skipLines | back to summary |
|---|---|
| public void skipLines(long lineCount) Skips characters in the input until the given number of lines is discarded.
| |
| skipQuotedString | back to summary |
|---|---|
| public boolean skipQuotedString(char quote, char escape, char stop1, char stop2) Attempts to skip a quoted
| |
| skipString | back to summary |
|---|---|
| public boolean skipString(char ch, char stop) Attempts to skip a
| |
| skipWhitespace | back to summary |
|---|---|
| public char skipWhitespace(char current, char stopChar1, char stopChar2) Skips characters from the current input position, until a non-whitespace character, or a stop character is found
| |
| start | back to summary |
|---|---|
| public void start(Reader reader) Initializes the CharInputReader implementation with a
| |
| stop | back to summary |
|---|---|
| public void stop() Stops the CharInputReader from reading characters from the | |