| java.lang.Object | |
| ↳ | java.io.StreamTokenizer |
StreamTokenizer takes a stream and a set of tokens and parses them one at a time. The different types of tokens that can be found are numbers, identifiers, quoted strings, and different comment styles.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | TT_EOF | The constant representing end of stream. | |||||||||
| int | TT_EOL | The constant representing end of line. | |||||||||
| int | TT_NUMBER | The constant representing a number token. | |||||||||
| int | TT_WORD | The constant representing a word token. | |||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| nval | Contains a number if the current token is a number (ttype
is TT_NUMBER)
|
||||||||||
| sval | Contains a string if the current token is a word (ttype
is TT_WORD)
|
||||||||||
| ttype | The token type | ||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
This constructor is deprecated.
Use StreamTokenizer(Reader)
| |||||||||||
Construct a new StreamTokenizer on the Reader
r. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Set the character
ch to be regarded as a comment
character. | |||||||||||
Set a boolean indicating whether or not end of line is significant and
should be returned as
TT_EOF in ttype. | |||||||||||
Answer the current line number.
| |||||||||||
Set a boolean indicating whether or not tokens should be uppercased when
present in
sval. | |||||||||||
Answer the next token type.
| |||||||||||
Set the character
ch to be regarded as an ordinary
character. | |||||||||||
Set the characters ranging from
low to hi
to be regarded as ordinary characters. | |||||||||||
Indicate that numbers should be parsed.
| |||||||||||
Indicate that the current token should be pushed back and returned the
next time
nextToken() is called. | |||||||||||
Set the character
ch to be regarded as a quote character. | |||||||||||
Reset all characters so that they are ordinary.
| |||||||||||
Set a boolean indicating whether or not slash slash comments should be
recognized.
| |||||||||||
Set a boolean indicating whether or not slash star comments should be
recognized.
| |||||||||||
Answer the state of this tokenizer in a readable format.
| |||||||||||
Set the characters ranging from
low to hi
to be regarded as whitespace characters. | |||||||||||
Set the characters ranging from
low to hi
to be regarded as word characters. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
The constant representing end of stream.
The constant representing end of line.
The constant representing a number token.
The constant representing a word token.
Contains a number if the current token is a number (ttype
is TT_NUMBER)
Contains a string if the current token is a word (ttype
is TT_WORD)
The token type
This constructor is deprecated.Use StreamTokenizer(Reader)
Construct a new StreamTokenizer on the InputStream is. This usage of this method should be replaced with the constructor which takes a Reader.
| is | The InputStream to parse tokens on. |
|---|
Construct a new StreamTokenizer on the Reader r.
Initialize the default state per specification.
| r | The InputStream to parse tokens on. |
|---|
Set the character ch to be regarded as a comment
character.
| ch | The character to be considered a comment character. |
|---|
Set a boolean indicating whether or not end of line is significant and
should be returned as TT_EOF in ttype.
| flag | true if EOL is significant, false
otherwise.
|
|---|
Answer the current line number.
Set a boolean indicating whether or not tokens should be uppercased when
present in sval.
| flag | true if sval should be forced
uppercase, false otherwise.
|
|---|
Answer the next token type.
| IOException | If an IO error occurs while getting the token |
|---|
Set the character ch to be regarded as an ordinary
character.
| ch | The character to be considered an ordinary comment character. |
|---|
Set the characters ranging from low to hi
to be regarded as ordinary characters.
| low | The starting range for ordinary characters. |
|---|---|
| hi | The ending range for ordinary characters. |
Indicate that numbers should be parsed.
Indicate that the current token should be pushed back and returned the
next time nextToken() is called.
Set the character ch to be regarded as a quote character.
| ch | The character to be considered a quote comment character. |
|---|
Reset all characters so that they are ordinary.
Set a boolean indicating whether or not slash slash comments should be recognized. The comment ends at a new line.
| flag | true if // should be recognized
as the start of a comment, false otherwise.
|
|---|
Set a boolean indicating whether or not slash star comments should be recognized. Slash-star comments cannot be nested and end when a star-slash combination is found.
| flag | true if /* should be recognized
as the start of a comment, false otherwise.
|
|---|
Answer the state of this tokenizer in a readable format.
Set the characters ranging from low to hi
to be regarded as whitespace characters.
| low | The starting range for whitespace characters. |
|---|---|
| hi | The ending range for whitespace characters. |
Set the characters ranging from low to hi
to be regarded as word characters.
| low | The starting range for word characters. |
|---|---|
| hi | The ending range for word characters. |