O'Reilly logo

Java I/O by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required