public class ExtendedStreamTokenizer
extends java.lang.Object
Constructor and Description |
---|
ExtendedStreamTokenizer(java.io.InputStream inputStream,
boolean eolIsSignificant)
Constructs an ExtendedStreamTokenizer from the given InputStream.
|
ExtendedStreamTokenizer(java.io.InputStream inputStream,
int commentChar,
boolean eolIsSignificant)
Constructs an ExtendedStreamTokenizer from the given InputStream
|
ExtendedStreamTokenizer(java.io.Reader reader,
boolean eolIsSignificant)
Constructs an ExtendedStreamTokenizer from the given Reader.
|
ExtendedStreamTokenizer(java.lang.String path)
Creates and returns a stream tokenizer that has been properly configured to parse sphinx3 data This
ExtendedStreamTokenizer has no comment characters.
|
ExtendedStreamTokenizer(java.lang.String path,
boolean eolIsSignificant)
Creates and returns a stream tokenizer that has been properly configured to parse sphinx3 data This
ExtendedStreamTokenizer has no comment characters.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the tokenizer
|
void |
commentChar(int ch)
Specified that the character argument starts a single-line comment.
|
void |
expectInt(java.lang.String name,
int expecting)
Loads an integer from the tokenizer and ensures that it matches 'expecting'
|
void |
expectString(java.lang.String expecting)
Loads a word from the tokenizer and ensures that it matches 'expecting'
|
double |
getDouble(java.lang.String name)
gets a double from the tokenizer stream
|
float |
getFloat(java.lang.String name)
gets a float from the tokenizer stream
|
float |
getFloat(java.lang.String name,
float defaultValue)
gets a optional float from the tokenizer stream.
|
int |
getInt(java.lang.String name)
gets an integer from the tokenizer stream
|
int |
getLineNumber()
Gets the current line number
|
java.lang.String |
getString()
Gets the next word from the tokenizer
|
boolean |
isEOF()
Determines if the stream is at the end of file
|
void |
skipwhite()
Skip any carriage returns.
|
void |
unget(java.lang.String string)
Puts a string back, the next get will return this string
|
void |
whitespaceChars(int low,
int hi)
Specifies that all the characters between low and hi incluseive are whitespace characters
|
public ExtendedStreamTokenizer(java.lang.String path) throws java.io.FileNotFoundException
path
- the source of the datajava.io.FileNotFoundException
- if a file cannot be foundpublic ExtendedStreamTokenizer(java.lang.String path, boolean eolIsSignificant) throws java.io.FileNotFoundException
path
- the source of the dataeolIsSignificant
- if true eol is significantjava.io.FileNotFoundException
- if a file cannot be foundpublic ExtendedStreamTokenizer(java.io.InputStream inputStream, int commentChar, boolean eolIsSignificant)
inputStream
- the source of the datacommentChar
- the comment charactereolIsSignificant
- true if EOL is significant, false otherwisepublic ExtendedStreamTokenizer(java.io.InputStream inputStream, boolean eolIsSignificant)
inputStream
- the source of the dataeolIsSignificant
- true if EOL is significant, false otherwisepublic ExtendedStreamTokenizer(java.io.Reader reader, boolean eolIsSignificant)
reader
- the source of the dataeolIsSignificant
- true if eol is significantpublic void close() throws java.io.IOException
java.io.IOException
- if an error occurs while closing the streampublic void whitespaceChars(int low, int hi)
low
- the low end of the rangehi
- the high end of the rangepublic void commentChar(int ch)
ch
- the comment characterpublic java.lang.String getString() throws java.io.IOException
java.io.StreamCorruptedException
- if the word does not matchjava.io.IOException
- if an error occurs while loading the datapublic void unget(java.lang.String string)
string
- the string to ungetpublic boolean isEOF()
public int getLineNumber()
public void expectString(java.lang.String expecting) throws java.io.IOException
expecting
- the word read must match thisjava.io.StreamCorruptedException
- if the word does not matchjava.io.IOException
- if an error occurs while loading the datapublic void expectInt(java.lang.String name, int expecting) throws java.io.IOException
name
- the name of the valueexpecting
- the word read must match thisjava.io.StreamCorruptedException
- if the word does not matchjava.io.IOException
- if an error occurs while loading the datapublic int getInt(java.lang.String name) throws java.io.IOException
name
- the name of the parameter (for error reporting)java.io.StreamCorruptedException
- if the next value is not ajava.io.IOException
- if an error occurs while loading the data numberpublic double getDouble(java.lang.String name) throws java.io.IOException
name
- the name of the parameter (for error reporting)java.io.StreamCorruptedException
- if the next value is not ajava.io.IOException
- if an error occurs while loading the data numberpublic float getFloat(java.lang.String name) throws java.io.IOException
name
- the name of the parameter (for error reporting)java.io.StreamCorruptedException
- if the next value is not ajava.io.IOException
- if an error occurs while loading the data numberpublic float getFloat(java.lang.String name, float defaultValue) throws java.io.IOException
name
- the name of the parameter (for error reporting)defaultValue
- the default valuejava.io.StreamCorruptedException
- if the next value is not ajava.io.IOException
- if an error occurs while loading the data numberpublic void skipwhite() throws java.io.IOException
java.io.IOException
- if an error occurs while reading data from the stream.