CharInputReader.
It provides the essential conversion of sequences of newline characters defined by Format#getLineSeparator() into the normalized newline character provided in Format#getNormalizedNewline().
It also provides a default implementation for most of the methods specified by the CharInputReader interface.
Extending classes must essentially read characters from a given java. and assign it to the public AbstractCharInputReader#buffer when requested (in the AbstractCharInputReader#reloadBuffer() method).
com.univocity.parsers.common.Format , com.univocity.parsers.common.input.DefaultCharInputReader , com.univocity.parsers.common.input.concurrent.ConcurrentCharInputReader
| Modifier and Type | Field and Description |
|---|---|
| public char[] | buffer
The buffer itself |
| private char | |
| private long | |
| protected final boolean | |
| private boolean | |
| private final boolean | |
| public int | i
Current position in the buffer |
| private boolean | |
| private List | |
| public int | length
Number of characters available in the buffer. |
| private long | |
| private char | |
| private char | |
| private boolean | |
| private final char | |
| private boolean | |
| private int | |
| private boolean | |
| private final ExpandingCharAppender | |
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| public | AbstractCharInputReader(char
the normalized newline character (as defined in normalizedLineSeparator, int Format#getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.starting range of characters considered to be whitespace. whitespaceRangeStart, boolean indicates whether to automatically close the input when closeOnStop)stop() is calledCreates a new instance that attempts to detect the newlines used in the input automatically. |
| public | AbstractCharInputReader(char[]
the sequence of characters that represent a newline, as defined in lineSeparator, char Format#getLineSeparator()the normalized newline character (as defined in normalizedLineSeparator, int Format#getNormalizedNewline()) that is used to replace any lineSeparator sequence found in the input.starting range of characters considered to be whitespace. whitespaceRangeStart, boolean indicates whether to automatically close the input when closeOnStop)stop() is calledCreates a new instance with the mandatory characters for handling newlines transparently. |
| Modifier and Type | Method and Description |
|---|---|
| public final void | addInputAnalysisProcess(InputAnalysisProcess
a custom process to analyze the contents of the input buffer. inputAnalysisProcess)Submits a custom |
| public final long | charCount()
Implements com. CharInputReader#nextChar() at any given time.
|
| public final String | currentParsedContent()
Implements com. |
| public final int | currentParsedContentLength()
Implements com. |
| public final void | enableNormalizeLineEndings(boolean
flag indicating that the parser is escaping values and line separators are to be returned as-is. normalizeLineEndings)Implements com. |
| public final char | getChar()
Implements com. nextChar() method.
|
| public char[] | getLineSeparator()
Implements com. |
| public final String | getQuotedString(char
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)Implements com. String from the current position until a closing quote or stop character is found on the input,
or a line ending is reached.
|
| public final String | getString(char
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 returnedImplements com. String from the current position until a stop character is found on the input,
or a line ending is reached.
|
| public final int | lastIndexOf(char
the character to look for ch)Implements com. |
| public final long | lineCount()
Implements com. |
| public final void | markRecordStart()
Implements com. currentParsedContent()
|
| public final char | nextChar()
Implements com. java..
|
| public String | readComment()
Implements com. |
| protected abstract void | reloadBuffer()
Informs the extending class that the buffer has been read entirely and requests for another batch of characters. |
| private void | |
| protected abstract void | setReader(Reader
the reader)java. provided in AbstractCharInputReader#start(Reader)Passes the |
| public final void | skipLines(long
the number of lines to skip from the current location in the input lines)Implements com. |
| public final boolean | skipQuotedString(char
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)Implements com. String from the current position until a stop character is found on the input,
or a line ending is reached.
|
| public final boolean | skipString(char
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)Implements com. String from the current position until a stop character is found on the input,
or a line ending is reached.
|
| public final char | skipWhitespace(char
the current character of the input ch, char the first stop character (which can be a whitespace) stopChar1, char the second character (which can be a whitespace) stopChar2)Implements com. |
| private void | |
| public final void | start(Reader
A reader)java. that provides access to the input.Implements com. java. which provides access to the input.
|
| private void | |
| private void | |
| protected final void | |
| private void | updateBuffer()
Requests the next batch of characters from the implementing class and updates the character count. |
| buffer | back to summary |
|---|---|
| public char[] buffer The buffer itself | |
| ch | back to summary |
|---|---|
| private char ch | |
| charCount | back to summary |
|---|---|
| private long charCount | |
| closeOnStop | back to summary |
|---|---|
| protected final boolean closeOnStop | |
| commentProcessing | back to summary |
|---|---|
| private boolean commentProcessing | |
| detectLineSeparator | back to summary |
|---|---|
| private final boolean detectLineSeparator | |
| i | back to summary |
|---|---|
| public int i Current position in the buffer | |
| incrementLineCount | back to summary |
|---|---|
| private boolean incrementLineCount | |
| inputAnalysisProcesses | back to summary |
|---|---|
| private List<InputAnalysisProcess> inputAnalysisProcesses | |
| length | back to summary |
|---|---|
| public int length Number of characters available in the buffer. | |
| lineCount | back to summary |
|---|---|
| private long lineCount | |
| lineSeparator1 | back to summary |
|---|---|
| private char lineSeparator1 | |
| lineSeparator2 | back to summary |
|---|---|
| private char lineSeparator2 | |
| lineSeparatorDetected | back to summary |
|---|---|
| private boolean lineSeparatorDetected | |
| normalizedLineSeparator | back to summary |
|---|---|
| private final char normalizedLineSeparator | |
| normalizeLineEndings | back to summary |
|---|---|
| private boolean normalizeLineEndings | |
| recordStart | back to summary |
|---|---|
| private int recordStart | |
| skipping | back to summary |
|---|---|
| private boolean skipping | |
| tmp | back to summary |
|---|---|
| private final ExpandingCharAppender tmp | |
| whitespaceRangeStart | back to summary |
|---|---|
| pack-priv final int whitespaceRangeStart | |
| AbstractCharInputReader | back to summary |
|---|---|
| public AbstractCharInputReader(char normalizedLineSeparator, int whitespaceRangeStart, boolean closeOnStop) Creates a new instance that attempts to detect the newlines used in the input automatically.
| |
| AbstractCharInputReader | back to summary |
|---|---|
| public AbstractCharInputReader(char[] lineSeparator, char normalizedLineSeparator, int whitespaceRangeStart, boolean closeOnStop) Creates a new instance with the mandatory characters for handling newlines transparently.
| |
| addInputAnalysisProcess | back to summary |
|---|---|
| public final void addInputAnalysisProcess(InputAnalysisProcess inputAnalysisProcess) Submits a custom
| |
| charCount | back to summary |
|---|---|
| public final long charCount() Implements com. Doc from com. Returns the number of characters returned by
| |
| currentParsedContent | back to summary |
|---|---|
| public final String currentParsedContent() Implements com. Doc from com. Returns a String with the input character sequence parsed to produce the current record. | |
| currentParsedContentLength | back to summary |
|---|---|
| public final int currentParsedContentLength() Implements com. Doc from com. Returns the length of the character sequence parsed to produce the current record.
| |
| enableNormalizeLineEndings | back to summary |
|---|---|
| public final void enableNormalizeLineEndings(boolean normalizeLineEndings) Implements com. Doc from com. 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 final char getChar() Implements com. Doc from com. Returns the last character returned by the
| |
| getLineSeparator | back to summary |
|---|---|
| public char[] getLineSeparator() Implements com. Doc from com. Returns the line separator by this character input reader. This could be the line separator defined
in the
| |
| getQuotedString | back to summary |
|---|---|
| public final String getQuotedString(char quote, char escape, char escapeEscape, int maxLength, char stop1, char stop2, boolean keepQuotes, boolean keepEscape, boolean trimLeading, boolean trimTrailing) Implements com. Doc from com. Attempts to collect a quoted
| |
| getString | back to summary |
|---|---|
| public final String getString(char ch, char stop, boolean trim, String nullValue, int maxLength) Implements com. Doc from com. Attempts to collect a
| |
| lastIndexOf | back to summary |
|---|---|
| public final int lastIndexOf(char ch) Implements com. Doc from com. Returns the last index of a given character in the current parsed content
| |
| lineCount | back to summary |
|---|---|
| public final long lineCount() Implements com. Doc from com. Returns the number of newlines read so far.
| |
| markRecordStart | back to summary |
|---|---|
| public final void markRecordStart() Implements com. Doc from com. Marks the start of a new record in the input, used internally to calculate the result of
| |
| nextChar | back to summary |
|---|---|
| public final char nextChar() Implements com. Doc from 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() Implements com. Doc from com. Collects the comment line found on the input. | |
| reloadBuffer | back to summary |
|---|---|
| protected abstract void reloadBuffer() Informs the extending class that the buffer has been read entirely and requests for another batch of characters.
Implementors must assign the new character buffer to the public | |
| setLineSeparator | back to summary |
|---|---|
| private void setLineSeparator(char[] lineSeparator) | |
| setReader | back to summary |
|---|---|
| protected abstract void setReader(Reader reader) Passes the
| |
| skipLines | back to summary |
|---|---|
| public final void skipLines(long lines) Implements com. Doc from com. Skips characters in the input until the given number of lines is discarded.
| |
| skipQuotedString | back to summary |
|---|---|
| public final boolean skipQuotedString(char quote, char escape, char stop1, char stop2) Implements com. Doc from com. Attempts to skip a quoted
| |
| skipString | back to summary |
|---|---|
| public final boolean skipString(char ch, char stop) Implements com. Doc from com. Attempts to skip a
| |
| skipWhitespace | back to summary |
|---|---|
| public final char skipWhitespace(char ch, char stopChar1, char stopChar2) Implements com. Doc from com. Skips characters from the current input position, until a non-whitespace character, or a stop character is found
| |
| start | back to summary |
|---|---|
| private void start(Reader reader, boolean resetTmp) | |
| start | back to summary |
|---|---|
| public final void start(Reader reader) Implements com. Doc from com. Initializes the CharInputReader implementation with a
| |
| submitLineSeparatorDetector | back to summary |
|---|---|
| private void submitLineSeparatorDetector() | |
| throwEOFException | back to summary |
|---|---|
| private void throwEOFException() | |
| unwrapInputStream | back to summary |
|---|---|
| protected final void unwrapInputStream(BomInput. | |
| updateBuffer | back to summary |
|---|---|
| private void updateBuffer() Requests the next batch of characters from the implementing class and updates the character count. If there are no more characters in the input, the reading will stop by invoking the | |