CharInputReader that wraps another CharInputReader and
collects a sequence of characters from the wrapped input, in order to analyze what the buffer contains
ahead of the current position.
| Modifier and Type | Field and Description |
|---|---|
| private char | |
| private int | |
| private char[] | |
| private final char | |
| private final CharInputReader | |
| private int | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | LookaheadCharInputReader(CharInputReader
the input reader whose characters will read and stored in a limited internal buffer,
in order to allow a parser to query what the characters are available ahead of the current input position. reader, char the normalized character that represents a line ending. Used internally as a stop character. newLine, int starting range of characters considered to be whitespace. whitespaceRangeStart)Creates a lookahead input reader by wrapping a given |
| Modifier and Type | Method and Description |
|---|---|
| public long | charCount()
Implements com. CharInputReader#nextChar() at any given time.
|
| public String | currentParsedContent()
Implements com. |
| public int | currentParsedContentLength()
Implements com. |
| public void | enableNormalizeLineEndings(boolean
flag indicating that the parser is escaping values and line separators are to be returned as-is. escaping)Implements com. |
| public final char | getChar()
Implements com. nextChar() method.
|
| public char[] | getLineSeparator()
Implements com. |
| public String | Returns: the current lookahead value, or an emptyString if the lookahead buffer is empty.Returns the current lookahead value. |
| public String | Returns: aString formed by the given character followed by the lookahead value (if any).the current character obtained by the parser current)Returns the lookahead value prepended with the current character |
| public 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 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 int | lastIndexOf(char
the character to look for ch)Implements com. |
| public long | lineCount()
Implements com. |
| public void | lookahead(int
the number of characters to read from the wrapped numberOfCharacters)CharInputReader, given in the constructor of this class.Fills the lookahead buffer with a given number of characters that will be extracted from the wrapped |
| public void | markRecordStart()
Implements com. currentParsedContent()
|
| public boolean | Returns: true if the current character and the sequence characters that follows are present in the lookahead, otherwise falsethe last character used by the parser, which should match the first character in the lookahead buffer current, char[] the expected sequence of characters after the current character, that are expected appear in the current lookahead buffer sequence, char character used in the sequence as a wildcard (e.g. * or ?), meaning any character is acceptable in its place. wildcard)Matches a sequence of characters against the current lookahead buffer. |
| public boolean | Returns: true if the given sequence of characters is present in the lookahead, otherwise falsethe expected sequence of characters that are expected appear in the current lookahead buffer sequence, char character used in the sequence as a wildcard (e.g. * or ?), meaning any character is acceptable in its place. wildcard)Matches a sequence of characters against the current lookahead buffer. |
| public char | nextChar()
Implements com. java..
|
| public String | readComment()
Implements com. |
| public void | |
| public void | skipLines(long
the number of lines to skip from the current location in the input lineCount)Implements com. |
| public 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 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 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. |
| public void | start(Reader
A reader)java. that provides access to the input.Implements com. java. which provides access to the input.
|
| public void | stop()
Implements com. java. provided in CharInputReader#start(Reader) and closes it.
|
| delimiter | back to summary |
|---|---|
| private char delimiter | |
| length | back to summary |
|---|---|
| private int length | |
| lookahead | back to summary |
|---|---|
| private char[] lookahead | |
| newLine | back to summary |
|---|---|
| private final char newLine | |
| reader | back to summary |
|---|---|
| private final CharInputReader reader | |
| start | back to summary |
|---|---|
| private int start | |
| whitespaceRangeStart | back to summary |
|---|---|
| private final int whitespaceRangeStart | |
| LookaheadCharInputReader | back to summary |
|---|---|
| public LookaheadCharInputReader(CharInputReader reader, char newLine, int whitespaceRangeStart) Creates a lookahead input reader by wrapping a given
| |
| charCount | back to summary |
|---|---|
| public long charCount() Implements com. Doc from com. Returns the number of characters returned by
| |
| currentParsedContent | back to summary |
|---|---|
| public 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 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 void enableNormalizeLineEndings(boolean escaping) 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
| |
| getLookahead | back to summary |
|---|---|
| public String getLookahead() Returns the current lookahead value.
| |
| getLookahead | back to summary |
|---|---|
| public String getLookahead(char current) Returns the lookahead value prepended with the current character
| |
| 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) Implements com. Doc from com. Attempts to collect a quoted
| |
| getString | back to summary |
|---|---|
| public 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 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 long lineCount() Implements com. Doc from com. Returns the number of newlines read so far.
| |
| lookahead | back to summary |
|---|---|
| public void lookahead(int numberOfCharacters) Fills the lookahead buffer with a given number of characters that will be extracted from the wrapped
| |
| markRecordStart | back to summary |
|---|---|
| public void markRecordStart() Implements com. Doc from com. Marks the start of a new record in the input, used internally to calculate the result of
| |
| matches | back to summary |
|---|---|
| public boolean matches(char current, char[] sequence, char wildcard) Matches a sequence of characters against the current lookahead buffer.
| |
| matches | back to summary |
|---|---|
| public boolean matches(char[] sequence, char wildcard) Matches a sequence of characters against the current lookahead buffer.
| |
| nextChar | back to summary |
|---|---|
| public 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 |
|---|---|
| public void reloadBuffer() | |
| skipLines | back to summary |
|---|---|
| public void skipLines(long lineCount) Implements com. Doc from com. 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) Implements com. Doc from com. Attempts to skip a quoted
| |
| skipString | back to summary |
|---|---|
| public boolean skipString(char ch, char stop) Implements com. Doc from com. Attempts to skip a
| |
| skipWhitespace | back to summary |
|---|---|
| public 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 |
|---|---|
| public void start(Reader reader) Implements com. Doc from com. Initializes the CharInputReader implementation with a
| |
| stop | back to summary |
|---|---|
| public void stop() Implements com. Doc from com. Stops the CharInputReader from reading characters from the
| |