The Java Posse podcast recently interviewed Bruce Eckel. About 32 minutes into the first of a two part interview Bruce says the following about the Java IO library:
“I don’t know if they (Sun) are just in denial or what. Opening a file is still a nightmare.”
It was good to hear one of the Java luminaries speak to this fact. I remember teaching an intro class on Java to about 24 people and explaining all the wonderful PrintWriters and BufferedReaders. For the majority of the class it was completely confusing. And despite hand waving about you need these streams because the file might be located across the network it was still very hard to grasp. It’s another one of those things where I have to look at some sample code every time I need to actually open a file in Java.
Anyway Bruce’s solution was to write a utility class to handle it.