Shouldn't ObjectInputStream extend FilterInputStream?

Posted by Vaibhav Bajpai on Stack Overflow See other posts from Stack Overflow or by Vaibhav Bajpai
Published on 2010-05-24T12:37:27Z Indexed on 2010/05/24 12:41 UTC
Read the original article Hit count: 334

Filed under:
|
|

The block quotes are from the Java Docs -

A FilterInputStream contains some other input stream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.

A DataInputStream lets an application read primitive Java data types from an underlying input stream in a machine-independent way.

The DataInputStream therefore extends FilterInputStream

An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream.

However, for some reason the ObjectInputStream does NOT extend FilterInputStream even though it is also reading objects (this time and not primitive types) from the underlying input stream. Here is the branching of the concerned classes.

alt text

Is there is a design reasoning for the same?

© Stack Overflow or respective owner

Related posts about java

Related posts about design-patterns