Java IO Streams
In this tutorial, we will learn Java IO Streams. A stream is a flow of data from the data source to the data destination. A stream is a logical connection between two areas/resources. The data is read from the data source and written to the data destination.
Streams can be divided into two main types Byte streams and Character streams. All the stream classes are defined in the java.io package. We need to import from this package the classes whenever we use stream classes in the Java program.
Byte streams use plain bytes like in ASCII (8-bit) format and are mostly suited for standalone Java applications. Byte streams can be done using two classes:
When the data is read ( the flow is towards the Java program) it is called InputStream. The InputSream is an abstract superclass of all classes representing an input stream of bytes.
When the data is stored or written (flow is outwards or away from the Java program) it is called OutputStream. The OutputStream is an abstract superclass of all classes representing an output stream of bytes.
Both InputStream and OutputStream classes are abstract and cannot be instantiated. The System class defines three stream objects for communication with standard I/O devices.
Character streams are the flow of characters for example Unicode (UTF-16/ 16-bit encoding) format. Character streams can be done using two classes:
Character streams are suitable for standalone as well as in web applications.
Java Tutorial on this website:
For more information on Java, visit the official website :