Java defines a common way of handling all input/output devices, namely as producers/consumers of sequences of data (characters). The concept of stream represents a sequence of data generated by a input device or consumed by an output device.
Example of input streams:
Example of output streams:
All classes used to define the various streams are derived from the classes InputStream and OutputStream according to the following diagram.
This common handling of all input/output devices allow us to define the readers for the input channels and the writers for the output channels independently from the specific device used to realize the input/output (as we will see in the following).