public class StringCharStream extends Object implements CharStream
String. Notice that none of the overridden methods throw IOException.EOI| Constructor and Description |
|---|
StringCharStream(String in) |
| 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. |
String |
toString() |
public StringCharStream(String in)
public int peek()
CharStreampeek in interface CharStreamCharStream.EOI This stream is at end-of-inputpublic boolean peek(char c)
CharStreampeek in interface CharStreampublic int peek(String chars)
CharStreamString. Does
not consume any characters.peek in interface CharStreamString, or -1public char read()
throws EOFException
CharStreamread in interface CharStreamEOFException - This stream is at end-of-inputpublic void read(char c)
throws EOFException,
UnexpectedCharacterException
CharStreamread in interface CharStreamEOFException - This stream is at end-of-inputUnexpectedCharacterException - The next character does not equal the given characterpublic int read(String chars) throws EOFException, UnexpectedCharacterException
CharStreamString.read in interface CharStreamStringEOFException - This stream is at end-of-inputUnexpectedCharacterException - The next character on this stream is not in the given Stringpublic boolean peekRead(char c)
CharStreampeekRead in interface CharStreamtrue iff the next character on this stream equals the given characterpublic int peekRead(String chars)
CharStreamString, it is consumed.peekRead in interface CharStreamString, or -1public void eoi()
throws UnexpectedCharacterException
eoi in interface CharStreamUnexpectedCharacterException - This stream is not at end-of-inputpublic boolean atEoi()
atEoi in interface CharStreamCopyright © 2022. All rights reserved.