StreamTokenizer class
This class converts an instance of a Reader class to a StreamTokenizer. There is a similar StringTokenizer class.
It parses the characters into a stream of “tokens” separated by white space, and skipping comments.
Types of tokens:
- TT_WORD, TT_NUMBER, TT_EOL, TT_EOF
A set of flags controls aspects of the parsing.
A typical application
- creates an instance of StreamTokenizer
- sets the flags to control the parsing
- repeatedly calls a method nexttoken(), which advances the stream by one token and returns the type of the token. Based on the token type, the value of the token is either in the variable sval (WORDS) or nval (NUMBERS). sval has type String and nval has type double.