public class ReaderCharacterSource extends java.lang.Object implements CharacterSource
| Constructor and Description |
|---|
ReaderCharacterSource(java.io.Reader reader) |
ReaderCharacterSource(java.io.Reader reader,
int readAheadSize) |
ReaderCharacterSource(java.lang.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.
|
java.lang.String |
errorDetails(java.lang.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(java.io.Reader reader,
int readAheadSize)
public ReaderCharacterSource(java.io.Reader reader)
public ReaderCharacterSource(java.lang.String string)
public final int nextChar()
CharacterSourcenextChar in interface CharacterSourcepublic final int currentChar()
CharacterSourcecurrentChar in interface CharacterSourcepublic final boolean hasChar()
CharacterSourcehasChar in interface CharacterSourcepublic final boolean consumeIfMatch(char[] match)
CharacterSourceconsumeIfMatch in interface CharacterSourcepublic final int location()
CharacterSourcelocation in interface CharacterSourcepublic final int safeNextChar()
CharacterSourcesafeNextChar in interface CharacterSourcepublic char[] findNextChar(int match,
int esc)
CharacterSourcefindNextChar in interface CharacterSourcematch - character to findesc - escape character to avoid next char if escapedpublic boolean hadEscape()
hadEscape in interface CharacterSourcepublic void skipWhiteSpace()
CharacterSourceskipWhiteSpace in interface CharacterSourcepublic char[] readNumber()
CharacterSourcereadNumber in interface CharacterSourcepublic java.lang.String errorDetails(java.lang.String message)
errorDetails in interface CharacterSource