|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.io.Reader
|
+--java.io.StringReader
|
+--CharReader
A simple reader for reading chars one at a time from a String. Both peek() and read() methods are provided. Any whitespace is is skipped. For debugging purposes, a trace of characters read can be turned on or off (default is off).
| Field Summary | |
(package private) static int |
eof
Integer returned by StringReader for end of input. |
(package private) static char |
nullchar
Character returned when end of input reached. |
(package private) boolean |
traceOn
Indicate whether tracing is on or off. |
| Fields inherited from class java.io.StringReader |
|
| Fields inherited from class java.io.Reader |
lock |
| Constructor Summary | |
(package private) |
CharReader(java.lang.String s)
Construct a CharReader for a String. |
| Method Summary | |
char |
get()
Get the next non-whitespace "character", returning nullchar if there are no more characters. |
boolean |
hasMore()
Return true if there are more characters to be get, false otherwise. |
char |
peek()
Return the next non-whitespace character, but leave the character in the input to be gotten again. |
private int |
readNonWhiteSpace()
Get the next non-whitespace character, returning nullchar if there are no more characters. |
void |
setTrace(boolean traceOn)
Set the trace on or off. |
java.lang.String |
toString()
Return the remaining input as a String. |
| Methods inherited from class java.io.StringReader |
close, mark, markSupported, read, read, ready, reset, skip |
| Methods inherited from class java.io.Reader |
read |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
boolean traceOn
static char nullchar
static int eof
| Constructor Detail |
CharReader(java.lang.String s)
| Method Detail |
public char get()
public char peek()
public boolean hasMore()
public java.lang.String toString()
toString in class java.lang.Objectprivate int readNonWhiteSpace()
public void setTrace(boolean traceOn)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||