




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
How to use java's datainputstream and dataoutputstream classes to read and write primitive data types to input and output streams. It also covers the objectinputstream and objectoutputstream classes for handling class objects, and the serializable interface for making user-defined classes writable to streams.
Typology: Study notes
1 / 8
This page cannot be seen from the preview
Don't miss anything!





DataInputStream DataOutputStream
-^
DataInputStream– readBoolean()– readByte()– readChar()– readDouble()– readFloat()– readInt()– readLong()– readShort()
-^
DataOutputStream has corresponding writemethods
ObjectInputStream ObjectOutputStream
-^
Since usually our programs do not consist of onlyprimitive data types, we also may wish to read and writeclass objects to streams
-^
We can do this with the ObjectInputStream andObjectOutputStream
-^
In fact, the ObjectInputStream and ObjectOutputStreamclasses provide the same functionality asDataInputStream and DataOutputStream, except theyalso include support for reading and writing object datavia readObject() and writeObject() methods