Presentation by:
Joshi
Input Output Streams
Stream
• Stream is an Object used to transfer the
data from input unit to memory, memory
to output unit.
• InputStream
– Used to read the data from any input
resource
• OutputStream
– Used to write the data on to the output
resource.
IN
PUT
R O
UTP
UT
R INPUT STREAM
ESO
A OUTPUT STREAM
R
URC
E M ESO
URC
Example: E
Example:
Key Board Console
File File
Object Object
Types of Stream in JAVA
1. Byte Based Stream
InputStream
IOIOIOIOIOIOIOIOIOIOI
OutputStream
2. Character Based Stream
Reader
Writer
ABCDEFGHIJKLMNOP
Object
InputStream OutputStream
FileInputStream ObjectInputStream FileOuputStream ObjectOutputStream
FilterInputStream FilterOutputStream
BufferedInputStream DataInputStream DataOutputStream BuffredOutputStream
OBJECT
READER WRITER
BufferedReader InputStreamReader BufferedWriter OutputStreamWriter
FileReader FileWriter
File
• File is an Object which is an abstract
representation of file and directory
pathnames.
• This class presents system-independent
view of hierarchical pathnames.
• File has two components:
– Directory pathname
– File / SubDirectory name.
File
• File(String pathname)
• File(String dir, String filename)
• File(File parent, String filename)
• File(URI uri)