All the data under process or being read exist only till program is executed. As the program gets over, data is removed. File is a resource for storing information that is available to computer programs. Data in the file remains available for programs to use after the current program has finished. A particular type of file is used to hold specific type of data. The main purpose of files is to store data permanently. According to the way of representation and storage of data, files can be categorised into two types Character or Text files and Binary files. Character file represents a collection of characters that can be read by the text editor. Binary file stores data in machine readable form. All data records are represented using sequence of 0 and 1. These are non-text files that require a special purpose program to execute or display the contents of the file. Java uses the concept of streams to represent the ordered sequence of data, a common characteristic shared by all IO devices. Java stream is a collection of predefined classes and interfaces, used for input output purposes. It provides methods to read and write data into file from the program.
Java.i-o package contains two stream classes Byte stream class and Character stream class. Byte Stream class is used for byte oriented IO, i.e., reads and writes data in the form of binary numbers. Byte oriented IO operations are performed on binary files. Byte Stream can be further categorised into Input Stream Classes and Output Stream Classes. Character Stream Class is used for character oriented IO, i.e., reads and writes data in the form of characters. Character Stream can be further categorised into two parts Reader Class and Writer Class. Byte stream classes are used for byte orientation IO. They are further categorized into Input stream classes and Output stream classes. Byte stream classes are used for byte orientated IO. Read and write operations can be done using Input stream classes and Output stream classes. Both character stream class and byte stream class can be further categorised into following three types of streams Memory Stream, Pipe stream and File Stream.