public class SimpleParser
extends java.io.StreamTokenizer
Constructor and Description |
---|
SimpleParser(java.io.Reader reader)
Creates a simple parser from a character stream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
eof()
Checks for the end-of-file token.
|
java.lang.String |
getKey(java.lang.String expected)
Gets a key word from the tokenizer.
|
double |
getNumber()
Gets a number from the tokenizer.
|
java.lang.String |
getString()
Gets a string from the tokenizer.
|
java.lang.String |
getWord()
Gets a word from the tokenizer.
|
public SimpleParser(java.io.Reader reader)
reader
- the reader object providing the input stream.public java.lang.String getWord() throws java.io.IOException
java.io.IOException
- if a word was not found at the next token.public java.lang.String getString() throws java.io.IOException
java.io.IOException
- if a string was not found at the next token.public double getNumber() throws java.io.IOException
java.io.IOException
- if a number was not found at the next token.public java.lang.String getKey(java.lang.String expected) throws java.io.IOException
expected
- the expected key or null of no specific key is
expected.java.io.IOException
- if no key was found or the the expected key
was not found at the next token.public boolean eof() throws java.io.IOException
java.io.IOException
- if an error occurred reading the input stream.