public interface CharStream
chars. These can either be "read", which means basically the same as
Reader.read(); or they can be "peeked", which means that the next character is returned, but not consumed,
i.e. the next call to read() or peek() will return that character again.| Modifier and Type | Field and Description |
|---|---|
static int |
EOI
A special value for the values returned by
peek() and peekRead(char) indicating end-of-input. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
atEoi() |
void |
eoi() |
int |
peek()
Returns the next character on this stream but does not consume it.
|
boolean |
peek(char c)
Returns whether the character stream is not at end-of-input and the next character on this stream
equals the given character.
|
int |
peek(String chars)
Checks whether the next character on this stream equals any of the characters of the given
String. |
boolean |
peekRead(char c)
If the next character on this stream equals the given character, it is consumed.
|
int |
peekRead(String chars)
If the next character on this stream is in the given
String, it is consumed. |
char |
read()
Consumes and returns the next character on this stream.
|
void |
read(char c)
Consumes the next character on this stream and verifies that it equals the given character.
|
int |
read(String chars)
Consumes the nect character and verifies that it matches one of the characters of the given
String. |
static final int EOI
peek() and peekRead(char) indicating end-of-input.int peek() throws IOException
EOI This stream is at end-of-inputIOExceptionboolean peek(char c)
throws IOException
IOExceptionint peek(String chars) throws IOException
String. Does
not consume any characters.String, or -1IOExceptionchar read() throws EOFException, IOException
EOFException - This stream is at end-of-inputIOExceptionvoid read(char c) throws EOFException, UnexpectedCharacterException
EOFException - This stream is at end-of-inputUnexpectedCharacterException - The next character does not equal the given characterint read(String chars) throws EOFException, IOException, UnexpectedCharacterException
String.StringEOFException - This stream is at end-of-inputUnexpectedCharacterException - The next character on this stream is not in the given StringIOExceptionboolean peekRead(char c)
throws IOException
true iff the next character on this stream equals the given characterIOExceptionint peekRead(String chars) throws IOException
String, it is consumed.String, or -1IOExceptionboolean atEoi()
throws IOException
IOExceptionvoid eoi() throws UnexpectedCharacterException
UnexpectedCharacterException - This stream is not at end-of-inputCopyright © 2022. All rights reserved.