public class ReaderCharacterSource
extends Object
implements CharacterSource
Buffered CharacterSource implementation backed by a Reader.
| Constructor and description |
|---|
ReaderCharacterSource(Reader reader, int readAheadSize)Creates a buffered character source. |
ReaderCharacterSource(Reader reader)Creates a buffered character source with the default read-ahead size. |
ReaderCharacterSource(String string)Creates a character source over an in-memory string. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public final boolean |
consumeIfMatch(char[] match)Consumes the supplied character sequence when it matches the current position. |
|
public final int |
currentChar()Returns the current character without advancing. |
|
public String |
errorDetails(String message)Builds an error message using the current reader context. |
|
public char[] |
findNextChar(int match, int esc)Collects characters until the next unescaped match character. |
|
public boolean |
hadEscape()Reports whether the last string scan encountered an escape sequence. |
|
public final boolean |
hasChar()Checks whether another character is available. |
|
public final int |
location()Returns the current buffer index for diagnostics. |
|
public final int |
nextChar()Advances to the next character. |
|
public char[] |
readNumber()Reads a numeric token from the current position. |
|
public final int |
safeNextChar()Advances when possible and returns -1 at end of input. |
|
public void |
skipWhiteSpace()Advances past whitespace characters. |
Creates a buffered character source.
reader - reader supplying charactersreadAheadSize - number of characters to read per buffer refillCreates a buffered character source with the default read-ahead size.
reader - reader supplying charactersCreates a character source over an in-memory string.
string - JSON content to expose as charactersConsumes the supplied character sequence when it matches the current position.
match - character sequence to testtrue when the sequence was consumedReturns the current character without advancing.
Builds an error message using the current reader context.
message - parser-specific messageCollects characters until the next unescaped match character.
match - terminating character to search foresc - escape character that shields the following characterReports whether the last string scan encountered an escape sequence.
true when an escape was seenChecks whether another character is available.
true when more input remainsReturns the current buffer index for diagnostics.
Advances to the next character.
Reads a numeric token from the current position.
Advances when possible and returns -1 at end of input.
-1 when no more input remainsAdvances past whitespace characters.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.