Re: Interactive tracing ...
Andreas Leitgeb wrote:
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
that work! :-)
This is perennial complaint of mine as well.
In general, the Stream classes are older, and there were some
deficiencies found. So therefore the Reader and Writer classes were
introduced.
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.
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>
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.
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.
P.S. _Learning Java_ by O'Reilly. It goes into all this. ;-)