In this chapter, we are going to learn the input and output streams of the Java language. We all know that during the running of the program, the required data may need to be read from external storage media or other programs, which requires the use of input streams. The point of the input stream is called its source, and the program reads data from the source through the input stream.
On the other hand, after the program processes the data, it may need to write the processing results to a permanent storage medium or transmit them to other applications, which requires the use of an output stream. The point of the output stream is called its destination, and the program transfers data to the destination through the output stream.
Although I/O streams are most often associated with disk file access, the source and destination can also be the keyboard, memory, or monitor windows.
The java.io package (I/O stream library) provides a large number of stream classes . All input streams are subclasses of the abstract class InputStream (byte input stream) or the abstract class Reader (character input stream), and all output streams are A subclass of abstract class OutputStream (byte output stream) or abstract class Writer (character output stream).