Input/Outpur( I/O) Stream

I/O stands for input output. Input stream are used to read the data from input devices. Output stream are used to write the data to output devices.
 In the above diagram ,we are seeing some input devices keyboard, file, network socket these are the source for the data.
 here we also seeing some output device like monitor, file, network socket etc .these are the destination for the data.
We need to write a program which has to collect the data from input devices and has to process that data and your program has to send the  output  to some output devices.

When you write a C program for the above task. you get the following problem:---------
  •   In ‘C’ the low level implementation. We need to write in C program directly when device changes you need to modify the program again. This gives you much maintains and reduces the system flexibility.
  •   This problem was eliminated in java by providing the portable API in java .io package.    
Stream: It is a pipe which is connecting to physical devices or stream is a pipe which you can read the data from the input devices and you can write the data to output devices.
You can divide the stream into two types based on operation: ------
  •  Input stream 
  •   Output stream
Again stream is divided into two parts based on data: -------------
  • Byte Stream 
  • Character Stream  
 Byte Stream:  Byte Stream is used to pass the Byte data.
  • is the supper class for all input Byte Stream. 
  • is the super class for all output Byte Stream.  
It is used to read or write the byte data. These are two types of byte stream.
  • Input Byte Stream 
 Output Byte Stream                

The following are the some of the subclasses of input streams of i/p Stream abstract class: ---
  • BufferedInputStream 
  •  ByteArrayInputStream 
  •   FileInputStream 
  •   FilterInputStream
  • ObjectInputStream 
  •   PipedInputStream 
  •   PushbackInputStream 
  •  SequenceInputStream 
  •  StringBufferInputStream
The following are the some of the subclasses of OutputStream abstract class:--------

  •   BufferedOutputStream 
  •   ByteArrayOutputStream 
  •   DataOutputStream
  •  FilterOutputStream 
  •  ObjectOutputStream 
  •   PipedOutputStream 

Character Stream

It is used to read the character data from input devices  and write the character to output devices.
Character streams will help to achieve the internationalization .because java character set is Unicode(universal code)

There are two type of charecterStream:--------

  • InputCharacterStream  
  •  OutputCharacterStream is the super class for  all input character  Stream.  Javap is the super class for  all output character  Stream.

Following are the some subclasses of the Reader abstract class:--------
  •  BufferReader 
  •   CharArrayReader 
  •   FileReader 
  •   FilterReader
  • InputStreamReader 
  •  LineNumberReader
  • PipeReader 
  •   PushbackReader 
  •  StringReader             
Following are the some subclasses of writer abstract class:---------
  •  BufferedWriter 
  •  CharArrayWriter
  • FileWriter 
  •  OutputStreamWriter 
  •  PrintWriter 
  •  StringWriter  Writer 
  •  PipedWriter 
  • FilterWriter                               
There are two pre-defined constant in System class for Monitor and Keyboard
For Keyboard----
 For Monitor---    System.out