Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython
by Richard Hightower
The StreamTokenizer Class
StreamTokenizer breaks up an input stream into tokens and can be used to parse a simple file (excuse me, “input stream”). Read the Java API documentation on StreamTokenizer, and then compare what you read to the following methods
__init__(Reader)
__init__(InputStream)
nextToken()— returns the next token in the stream
lineno()— returns the current line number
lowerCaseMode(flag)— returns all words to lowercase if passed a true value
parseNumbers()— sets the parsing of floating-point numbers
pushBack()— pushes the token back onto the stream, returning it to the next nextToken() method call
quoteChar(char)— specifies the character string delimiter; the whole string is returned as a token in sval
resetSyntax()— sets all characters ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access