Distinguish between Input stream class and output stream class.
Java I/O (Input and Output) is used to process the input and produce the output.
Java uses the concept of a stream to make I/O operation fast. The java.io package contains all the classes required for input and output operations. A stream is a sequence of data. In Java, a stream is composed of bytes.
Sr. No.
|
Input stream class
|
Output stream class
|
1 |
Java application uses an input stream to read data from a source;
|
Java application uses an output stream to write data to a destination;
|
2 |
It may read from a file, an array, peripheral device or socket
|
It may be a write to file, an array, peripheral device or socket
|
3 |
Input stream classes reads data as bytes
|
Output stream classes writes data as bytes
|
4 |
Super class is the abstract inputStream class
|
Super class is the abstract OutputStream class
|
5 |
Methods: public int read() throws IOException public int available() throws IOException public void close() throws IOException
|
Methods: public void write(int b) throws IOException public void write(byte[] b) throws IOException public void flush() throws IOException public void close() throws IOException
|
6 |
The different subclasses of Input Stream are: File Input stream, Byte Array Input Stream, Filter Input Stream, Piped Input Stream, Object Input Stream, DataInputStream.
|
The different sub classes of Output Stream class are: File Output Stream, Byte Array Output Stream , Filter output Stream, Piped Output Stream, Object Output Stream, DataOutputStream
|