InputStream and OutputStream subclasses examples for performing Binary I/O.
-
To discover how I/O is processed in Java (§17.2).
-
To distinguish between text I/O and binary I/O (§17.3).
Text I/O involves encoding/decoding.
Binary I/O does not involve encoding/decoding and thus is more efficient than text I/O.
-
To read and write bytes using FileInputStream and FileOutputStream (§17.4.1).
Bytes & characters
-
To filter data using the base classes FilterInputStream and FilterOutputStream (§17.4.2).
Integers, doubles & strings
-
To read and write primitive values and strings using DataInputStream and DataOutputStream (§17.4.3).
Primitive numeric types
-
To store and restore objects using ObjectOutputStream and ObjectInputStream (§17.6).
Java class objects
-
To implement the Serializable interface to make objects serializable (§17.6.1).
Custom class objects (with serializable)
Serialization is the conversion of the state of an object into a byte stream; deserialization does the opposite. Stated differently, serialization is the conversion of a Java object into a static stream (sequence) of bytes which can then be saved to a database or transferred over a network.