public class ReaderCharacterSource extends Object implements CharacterSource
Constructor and Description |
---|
ReaderCharacterSource(Reader reader) |
ReaderCharacterSource(Reader reader,
int readAheadSize) |
ReaderCharacterSource(String string) |
Modifier and Type | Method and Description |
---|---|
boolean |
consumeIfMatch(char[] match)
Useful for finding constants in a string like true, false, etc.
|
int |
currentChar()
returns the current character without changing the IO pointer or index.
|
String |
errorDetails(String message) |
char[] |
findNextChar(int match,
int esc)
Used to find strings and their ilk
Finds the next non-escaped char
|
boolean |
hadEscape() |
boolean |
hasChar()
Checks to see if there is a next character.
|
int |
location()
This is mostly for debugging and testing.
|
int |
nextChar()
returns the next character moving the file pointer or index to the next location.
|
char[] |
readNumber()
Reads a number from the character source.
|
int |
safeNextChar()
Combines the operations of nextChar and hasChar.
|
void |
skipWhiteSpace()
Skip white space.
|
public ReaderCharacterSource(Reader reader, int readAheadSize)
public ReaderCharacterSource(Reader reader)
public ReaderCharacterSource(String string)
public final int nextChar()
CharacterSource
nextChar
in interface CharacterSource
public final int currentChar()
CharacterSource
currentChar
in interface CharacterSource
public final boolean hasChar()
CharacterSource
hasChar
in interface CharacterSource
public final boolean consumeIfMatch(char[] match)
CharacterSource
consumeIfMatch
in interface CharacterSource
public final int location()
CharacterSource
location
in interface CharacterSource
public final int safeNextChar()
CharacterSource
safeNextChar
in interface CharacterSource
public char[] findNextChar(int match, int esc)
CharacterSource
findNextChar
in interface CharacterSource
match
- character to findesc
- escape character to avoid next char if escapedpublic boolean hadEscape()
hadEscape
in interface CharacterSource
public void skipWhiteSpace()
CharacterSource
skipWhiteSpace
in interface CharacterSource
public char[] readNumber()
CharacterSource
readNumber
in interface CharacterSource
public String errorDetails(String message)
errorDetails
in interface CharacterSource