The java.io Package

The original source for much of the information contained herein about I/O is the javadoc documentation for the java.io package. You should have downloaded this with the JDK, but it’s also available online at:

http://java.sun.com/products/jdk/1.2/docs/api/java/io/package-summary.html (Java 1.2)
http://java.sun.com/products/jdk/1.1/docs/api/Package-java.io.html (Java 1.1)
http://java.sun.com/products/jdk/1.0.2/api/Package-java.io.html (Java 1.0)

The class library documentation is, however, woefully incomplete. While it explains what each method does, it often fails to explain how, why, or when you should use those methods. Furthermore, it only occasionally discusses assumptions about the behavior of those methods—assumptions that are crucial for anyone not merely using but also subclassing particular classes. There are many implicit assumptions about what particular methods should do (for instance, that a close() method of a filter input stream also closes any other streams it’s connected to), and these are generally not documented anywhere (or at least they weren’t until I wrote this book).

I’ve tried to document all of these assumptions in this book, but if you’re faced with a new class not covered here, the canonical reference is the source code itself. The JDK includes Java source code for the java packages. You’ll find it in a file called src.zip in your JDK distribution. Sometimes the only way to figure out exactly what Sun intended particular classes to do ...

Get Java I/O 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.