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 ...

Get Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.