public class ReaderCharRepeater extends java.lang.Object implements CharRepeater
| Constructor and Description |
|---|
ReaderCharRepeater(java.io.Reader reader)
Constructs the character repeater from a java.lang.Reader
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNextChar()
This is the key method used to take characters
off the input stream.
|
boolean |
isNextChar(char wanted)
Checks whether or not the next character is the same as
wanted.
|
boolean |
isNextString(java.lang.String wanted)
Checks whether or not the sequence of characters in the string wanted
is waiting to be read off the input.
|
char |
nextChar()
Returns the next character from the input, consuming it from the input.
|
char |
nextChar(char value_if_needed)
Returns the next character from the input, consuming it from the input.
|
char |
peekChar()
Returns the next character from the input, but does not consume it.
|
char |
peekChar(char value_if_needed)
Returns the next character from the input, but does not consume it.
|
void |
pushChar(char value)
Pushes a character onto the front of the input.
|
void |
skipChar()
Discards the next character from the input.
|
public ReaderCharRepeater(java.io.Reader reader)
reader - the input streampublic boolean hasNextChar()
hasNextChar in interface CharRepeaterpublic boolean isNextChar(char wanted)
isNextChar in interface CharRepeaterwanted - the character that we are looking forpublic boolean isNextString(java.lang.String wanted)
isNextString in interface CharRepeaterwanted - The sequence of characters that we are looking for.public char nextChar()
nextChar in interface CharRepeaterpublic char nextChar(char value_if_needed)
nextChar in interface CharRepeatervalue_if_needed - default returned if the input is exhausted.public void pushChar(char value)
pushChar in interface CharRepeatervalue - the character to be pushed backpublic char peekChar()
peekChar in interface CharRepeaterpublic char peekChar(char value_if_needed)
peekChar in interface CharRepeatervalue_if_needed - default returned if the input is exhausted.public void skipChar()
skipChar in interface CharRepeater