public class InputReader extends Object
Constructor and Description |
---|
InputReader(Reader reader)
Construct a InputReader from a string.
|
InputReader(String s)
Construct a InputReader from a string.
|
Modifier and Type | Method and Description |
---|---|
void |
back()
Back up one character.
|
InputException |
error(String message)
Resturns InputException to signal a syntax error.
|
boolean |
more()
Determine if the source string still contains characters that next()
can consume.
|
char |
next()
Get the next character in the source string.
|
String |
next(int n)
Get the next n characters.
|
char |
nextNonSpace()
Get the next char in the string, skipping whitespace.
|
public InputReader(Reader reader)
reader
- A reader.public InputReader(String s)
s
- A source string.public void back() throws InputException
InputException
public char next() throws InputException
InputException
public InputException error(String message)
message
- The error message.public char nextNonSpace() throws InputException
InputException
public String next(int n) throws InputException
n
- The number of characters to take.InputException
- Substring bounds error if there are not
n characters remaining in the source string.public boolean more() throws InputException
InputException
Copyright © 2019. All rights reserved.