Block quotes from Java Docs -
A FilterInputStream contains some other input stream that it uses as its main data source, possibly converting data along the way or providing additional functionality.DataInputStream allows the application to read primitive Java data types from the underlying input stream in a machine-independent manner.
A FilterInputStream contains some other input stream that it uses as its main data source, possibly converting data along the way or providing additional functionality.
DataInputStream allows the application to read primitive Java data types from the underlying input stream in a machine-independent manner.
Thus DataInputStreamexpandingFilterInputStream
DataInputStream
FilterInputStream
ObjectInputStream deserializes the primitive data and objects previously written using ObjectOutputStream.
However, for some reason, it ObjectInputStreamdoes NOT expand FilterInputStream, even if it also reads objects (this time, not primitive types) from the main input stream. Here is the fork of the corresponding classes.
ObjectInputStream
Is there the same design rationale?
A reasonable question. Thinking about this, I believe that it Object*Streamcould be designed for extension Filter*Stream(the same applies to Output or Input). Why has this not been done? Perhaps because:
Object*Stream
Filter*Stream
This does not give any real benefits. As Masage explains, the point Filter*Stream, in addition to some inconsequential class organization, is to provide some general (and rather trivial) implementation , (/ , ), ( Java API ). Filter*Stream : - , , , Filter*Stream. , *Stream Filter*Stream, , ; .
*Stream
ObjectOutputStream , , , ( OuputStream). ( , ) ( ) Filter*Stream. , .
ObjectOutputStream
OuputStream
:
LinkedList AbstractList, . List, , (, isEmpty size() == 0).
LinkedList
AbstractList
List
isEmpty
size() == 0
, GObject (, , Haskell - OO, ), alows , .
Java, Abstract* . Filter*Stream , - ( / Java - , / ), .
Abstract*
, ObjectInputStream FilterInputStream.
, .
: ObjectInputStream IS InputStream ( ), .