Python Programming with the Java™ Class Libraries: A Tutorial for Building Web and Enterprise Applications with Jython
by Richard Hightower
Summary
Streams are Java's way to support I/O. They can represent a file, a network connection, or access to a Web site. In this chapter, we dealt mostly with file streams because they're easy to work with and demonstrate stream fundamentals. Learning to deal with Java streams is essential for learning to use the Java APIs.
We covered some nonstream classes—RandomAccessFile, File, and StreamTokenizer. As we saw in the examples, RandomAccessFile works most like the Python file object. The Java File class allows access to a file's attributes: Is the file read-only? Is it a directory? and so forth. It also allows the creation of directories. The StreamTokenizer class works with any text stream (a class derived from Reader) or binary stream (a class ...
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