>> Especially finding the right stacking of streams and readers is something
>> that would have taken me a lot of time to get right - Thanks for
[quoted text clipped - 6 lines]
> deficiencies found. So therefore the Reader and Writer classes were
> introduced.
The Stream classes may be slightly older, in that it took all the way until
Java 1.1 [1] until they introduced Readers and Writers, but by no means does
that mean that Streams are deficient or no longer relevant. (What
"deficiencies" were found in Streams, anyway?)
The real difference, and the important one, is that Streams handle bytes and
Readers/Writers handle characters and their encodings. If you aren't handling
characters, do NOT use Readers and Writers. Streams are most emphatically not
obsolete.
> To bridge the two, use InputStreamReader and OutputStreamWriter. These
> both go from an older style IO (the Stream) to the newer version
> (Readers and Writers), just what you would expect for a class system
> that's been upgraded.
It's not about "upgrades", it's about whether you're processing binary or text
data.
> Check out this tutorial, paying particular attention to the the section
> on Character Streams. That's where the important bit is.
>
> <http://java.sun.com/docs/books/tutorial/essential/io/index.html>
You'll note that there's nothing in there about Streams' "deficiencies" or
about Readers/Writers substituting for Streams.
> After that, you just look up which IO Stream does what you want, which
> Reader or Writer gives you the final result you want, and put those two
> together with an IO Stream Reader/writer object if needed. Notice that
> this is just what Knute has done.
If you are reading character streams.
> Sometimes, you put a BufferedReader or -Writer in between a outer
> Reader/Writer and the IO Stream Reader/Writer. These last two
> paragraphs will get you 90% of what you need from Java IO.
Or you put the BufferedReader/Writer on top, not the middle.
> P.S. _Learning Java_ by O'Reilly. It goes into all this. ;-)
Again, it's Streams for binary data, Readers and Writers for encoded character
data, nothing to do with newer or older.
[1] I'll bet that very nearly all the Java programmers reading this post
learned Java at or after version 1.1. I myself started learning Java during
1.1 and started practicing it professionally with version 1.2. By that time,
Hashtable and Vector were already obsolete and the Reader and Writer classes
were well established.

Signature
Lew
Andreas Leitgeb - 07 Apr 2008 19:08 GMT
>>> Especially finding the right stacking of streams and readers is something
>>> that would have taken me a lot of time to get right - Thanks for saving me
[quoted text clipped - 5 lines]
> that mean that Streams are deficient or no longer relevant. (What
> "deficiencies" were found in Streams, anyway?)
I guess he means the unlucky decision to add a (since deprecated) readLine()
to the *InputStream-family.
> The real difference, and the important one, is that Streams handle bytes and
> Readers/Writers handle characters and their encodings.
So far it's clear, but it's not trivially obvious which *Reader class
can be wrapped on what *Stream class, and what interims-wrappers I need
to be finally able to read a whole line (->BufferedReader) from System.in .
I love the Scanner, though. Just pass it a File or System.in or a
String, and you get all the tokens you want.