In this section we will discuss the Java IO Object Streams.
To work with the I/O of objects Java provided the support of Object stream. Object stream classes implements either ObjectInput or the ObjectOutput interfaces. ObjectInput is the subinterface of DataInput and the ObjectOutput is the subinterface of DataOutput interface.
ObjectInput : ObjectInput is an interface which is a subinterface of DataInput interface that facilitate for reading the objects.
Class that implements the ObjectInput interface.
| Class | Description |
| ObjectInputStream | ObjectInputStream retrieves the previously serialized objects. This class can read only those objects which are of type java.io.Serializable or java.io.Externalizable. |
Methods of ObjectInput
ObjectOutput : ObjectOutput is an interface that extends the DataOutput interface which facilitate to write objects.
Class that implements the ObjectOutput interface.
| Class | Description |
| ObjectOutputStream | This class is used to write the primitive data types and graphs of Java objects into an output stream. This class can write only those objects which support the java.io.Serializable interface, into the output stream. Primitive data types and strings can be written to the output stream using the method of DataOutput interface |
Methods of ObjectOutput
|
Recommend the tutorial |
Ask Questions? Discuss: Java I/O Object Streams
Post your Comment