Byte Stream in Java
First of all to use the stream classes, we must import java.io package.
Byte streams are defined by using two class hierarchies.
At the top there are two abstract classes. First one is InputStream and another is OutputStream.
These both classes have various concrete subclasses to handle various devices such as files, network connections and even memory buffers.
Top most abstract classes InputStream and OutputStream define several key methods that the other stream classes implement.
Two of the most important methods are read( ) and write( ), which, respectively, read and write bytes of data.
Both methods are declared as abstract inside InputStream and OutputStream. They are overridden by derived stream classes.
The byte stream classes are shown in below table.