A: 

The BufferedReader is probably just decorating the InputReader being passed in. It makes no sense for a BufferedReader to accept a class it can't decorate, like an InputStream.

Tony Ennis
So does it mean there are other choices when connecting an InputStream obj to a BufferedReader besides through an InputStreamReader ?
dolaameng
I believe the InputStreamReader is a 'bridge' between a Reader and an InputStream. Read Fazal's answer below.
Tony Ennis
+3  A: 

There isn't any inconsistency... you should be comparing BufferedReader and BufferedWriter. They exist to wrap other Readers and Writers respectively.

The basic reason for that is that different types of Readers and Writers may have different ways of being initialized and different ways of functioning, not necessarily wrapping an InputStream or OutputStream at all. In your example of a BufferedReader wrapping an InputStreamReader, InputStreamReader can (and generally should) be initialized with both an InputStream and a Charset. Should BufferedReader have an overload for that, when its only job is to provide buffering?

ColinD
"InputStreamReader can (and generally should) be initialized with both an InputStream and a Charset" That's true, but the same applies to `OutputStreamWriter` and `PrintWriter`. You should specify a charset when creating an `OutputStreamWriter`, but `PrintWriter` doesn't have an overload for that. And PrintWriter also exists partly to wrap `Writer` objects (of any type).
Matthew Flaschen
@Matthew Flaschen: Some classes in the IO package are handled rather poorly as far as charsets. `PrintWriter` and `FileReader` are examples. I think `PrintWriter` should probably only be allowed to wrap another `Writer` (rather than having all the other overloads) and `FileReader` just shouldn't be used... `FileInputStream` + `InputStreamReader` instead.
ColinD
@Colin, I agree. And the fact that some classes rely solely on the default encoding, while others don't, is evidence that the package is partly inconsistent.
Matthew Flaschen
+1  A: 

Java introduced Reader and Writer hierarchy (java 1.1 I think) when Input and output stream classes were already in use. Therefore using a bridge pattern they allow you to have stream classes passed into reader classes. Further for writer also PritnerWriter is directly the bridge class which is equivalent to InputStreamReader. You will see the same thing for BufferedWriter too For more info read up http://www.codeguru.com/java/tij/tij0114.shtml

Fazal
Actually, `OutputStreamWriter` is the equivalent of `InputStreamReader`. `PrintWriter` is just an adapter that allows you to use the methods from `PrintStream` for writing to another `Writer`.
ColinD
Yes you are right. Sorry for the wrong comparison.
Fazal