Professional Documents
Culture Documents
I/O Stream
• An Input/Output (I/O) Stream represents an input source or an output
destination.
Input Vs Output Streams
• If the data flows from a source into a program, it is called as an input
stream.
• If the data flows from a program to a destination (aka sink or target), it
is
called as an output stream.
• Input streams can flow from the keyboard or from a file
– System.in is an input stream that connects to the keyboard.
e.g. Scanner scan= new Scanner(System.in);
• Output streams can flow to a screen or to a file
– System.out is an output stream that connects to the screen.
e.g. System.out.println(“Output Stream”);
Java Stream Classes
• The java.io package contains a large number of stream classes that provide
capabilities for processing all types of data.
• These classes may be categorized into two groups based on the data type on
which they operate.
– Byte stream classes
– Character stream classes