23.07.2013 Views

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Java</strong> I/O<br />

the word "subscribe" in the Subject: field. Archives of this and several related lists may be<br />

perused at http://www.DistributedObjects.com/portfolio/archives/patterns/index.html.<br />

A.3 The java.io Package<br />

The original source for much of the information contained herein about I/O is the javadoc<br />

documentation for the java.io package. You should have downloaded this with the JDK, but<br />

it's also available online at:<br />

http://java.sun.com/products/jdk/1.2/docs/api/java/io/package-summary.html (<strong>Java</strong><br />

1.2)<br />

http://java.sun.com/products/jdk/1.1/docs/api/Package-java.io.html (<strong>Java</strong> 1.1)<br />

http://java.sun.com/products/jdk/1.0.2/api/Package-java.io.html (<strong>Java</strong> 1.0)<br />

The class library documentation is, however, woefully incomplete. While it explains what<br />

each method does, it often fails to explain how, why, or when you should use those methods.<br />

Furthermore, it only occasionally discusses assumptions about the behavior of those<br />

methods—assumptions that are crucial for anyone not merely using but also subclassing<br />

particular classes. There are many implicit assumptions about what particular methods should<br />

do (for instance, that a close() method of a filter input stream also closes any other streams<br />

it's connected to), and these are generally not documented anywhere (or at least they weren't<br />

until I wrote this book).<br />

I've tried to document all of these assumptions in this book, but if you're faced with a new<br />

class not covered here, the canonical reference is the source code itself. The JDK includes<br />

<strong>Java</strong> source code for the java packages. You'll find it in a file called src.zip in your JDK<br />

distribution. Sometimes the only way to figure out exactly what Sun intended particular<br />

classes to do or how they expected them to do it is to read the source code for those classes.<br />

A.4 Network Programming<br />

In many ways this book is a prequel to my previous book with O'Reilly, <strong>Java</strong> Network<br />

Programming. Although written first, <strong>Java</strong> Network Programming presumes a solid<br />

familiarity with input and output, streams, and readers and writers as discussed in this book.<br />

<strong>Java</strong> Network Programming explains the fundamental protocols and technology that underlie<br />

the Internet, shows you how to communicate with sockets, provides detailed examples of<br />

working network clients and servers, and even develops content and protocol handlers. If you<br />

want to learn more about TCP/IP, HTTP, URLs, sockets and server sockets, and other<br />

elements of Internet programming in <strong>Java</strong>, you should definitely pick up <strong>Java</strong> Network<br />

Programming. (There's probably an ad for it in the back of this very book.)<br />

The Centre for Distance-spanning Technology (CDT) runs the unmoderated javanetworking@cdt.luth.se<br />

list for informal discussion of <strong>Java</strong> network programming, which I<br />

participate in. To subscribe, send an email containing the word "subscribe" in the body of the<br />

message to java-networking-request@cdt.luth.se. An archive of the list and complete<br />

instructions are available from http://www.cdt.luth.se/~peppar/java/java-networking-list/.<br />

460

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!