Update: The second edition of the Java I/O has been published. I'm keeping this page here to support readers who bought the first edition, as well as for readers of translations, since many of the translations are still based on the first edition. However, if you want the most current information, you should go to the second edition page instead.
The second edition is substantially improved over the second edition with lots of new and updated material. New topics include Java 1.4, 5, and 6, including the New I/O APIs, Bluetooth, USB, and J2ME. It is completely up-to-date with the state of the art in Java as of Java 6. If you're buying a new copy, you'll want to make sure you get the second edition. It's the one with the rabbit on the cover.
What a long strange trip this book has been. When I began writing the first draft back in September, 1997, I thought it would take me about two months and 200 pages. Now, a year and a half and 600 pages later, I've learned that I/O is a much bigger, more interesting, and more important topic than I originally dreamed. But I have managed to create what is unquestionably the best book I've ever written, and one in which I expect that all Java programmers will find something worthwhile, so I hope you won't mind if I take a few minutes to tell you about this book.
Java's input and output libraries have been unfairly maligned
for some time. It is widely (but incorrectly) believed that
I/O in Java is a lot weaker and a lot harder than
I/O in traditional languages like C, C++, and Pascal.
If anything, however, the exact opposite is true.
Java's I/O tools are far more
sophisticated, more powerful, and easier to use than
traditional printf()
/scanf()
style I/O.
Java I/O tells you all you need to know about the four main categories of streams and uncovers less known features to help make your I/O operations more efficient. Plus, it shows you how to control number formatting, use characters aside from the standard ASCII character set, and get a head start on writing truly multilingual software.
I/O in C, C++, and most other languages, is hamstrung by the assumption that what's being read or written is a 1970s era dumb terminal, or at least something very much like it. Java is the first major language to throw out this assumption. The designers of Java recognized that programs that read and write files, network connections, and serial port devices are a lot more important than toy programs from CS101 that read a number from the command line and square it. Consequently they created a language that focuses on solving professional programmers' real problems, instead of CS101 textbook examples. Rather than copying old-fashioned I/O APIs based on dumb ASCII terminals from the 1970s or DOS prompts from the 1980s, Java's designers created a new I/O API based on abstract streams. This API better suits the international network programs of the 1990s.
Unfortunately, precisely because Java I/O is structured so
differently from I/O in the languages most of us grew up with,
many programmers don't realize how simple and powerful it really
is. I first noticed this after I wrote Java
Network Programming. Many of the questions I got from
readers weren't about network programming at all.
They were about I/O. That's when I began thinking
seriously about writing a prequel to Java Network Programming; a book
that would cover the java.io
package
and show programmers how to really take advantage of
Java's I/O facilities to write very powerful programs
far more quickly than they could in any other language.
Java I/O is that book.
Here are just a few of the topics covered in depth in Java I/O:
InputStream
and OutputStream
And that's really just the beginning of what you'll learn from Java I/O. I'm really happy with this book. In fact it's perhaps the first book I've written that I really feel reached its full potential. I do hope you'll check it out. It's available from amazon.com, Fat Brain, and other purveyors of fine computer books. If you need to special order it, the ISBN number is 1-56592-485-1. It's $32.95, 596 pages, published by O'Reilly, and written by me, Elliotte Rusty Harold.
B. Character Sets