Lackadaisical One-to-One between Char and Byte Streams
- by Vaibhav Bajpai
I expected to have a one-to-one correspondence between the character streams and byte streams in terms of how the classes are organized in their hierarchy.
FilterReader and FilterWriter (character streams) correspond back to FilterInputStream and FilterOutputStream (byte stream) classes.
However I noticed few changes as -
BufferedInputStream extends FilterInputStream, but BufferedReader does NOT extend FilterReader.
BufferedOutputStream and PrintStream both extend FilterOutputStream, but BufferedWriter and PrintWriter does NOT extend FilterWriter.
FilterInputStream and FilterOutputStream are not abstract classes, but FilterReader and FilterWriter are.
I am not sure if I am being too paranoid to point out such differences, but was just curious to know if there was design reasoning behind such decision.