KEMBAR78
[Java] #7 - Input & Output Stream | PPTX
P.1
Input & Output Stream
ghadeer-al-hasan ghadeer.al.hasan.95@gmail.com
I/O P.2
 Input and Output is used to process the input and produce the output based
on the input
 The java.io package contains all the classes required for input and output operations
Stream
 Is a sequence of data, stream is composed of bytes.
 3 stream are created for us automatically. All these stream are attached with console
1) System.out
2) System.in
3) System.err
I/O P.3
 OutputStream: uses an output stream to write data a destination.
 InputStream: uses an input stream to read data from a source.
I/O P.4
 Input and Output is used to process the input and produce the output based
on the input
 The java.io package contains all the classes required for input and output operations
P.5
 Is an output stream for writing data to a file.
 You can write byte-oriented as well as character-oriented data.
FileOutputStream class:
FileInputStream class: P.6
 Obtains input bytes from a file.
 Is used for reading streams of raw bytes .
ByteArrayOutputStream class: P.7
 Is used to write data into multiple files.
 Holds a copy of data and forwards it to multiple streams.
Example: P.8
C:UsersGhadeerDesktop1.txt
C:UsersGhadeerDesktop2.txt
SequenceInputStream class: P.9
 Is used to read data from multiple stream.
 It reads data of stream one by one.
C:UsersGhadeerDesktop2.txt
C:UsersGhadeerDesktop1.txt
Example: P.10
C:UsersGhadeerDesktop1.txt
C:UsersGhadeerDesktop2.txt
C:UsersGhadeerDesktop3.txt
FileReader & FileWriter class: P.11
 Are used to write and read data from text files.
 There are character-oriented classed.
C:UsersGhadeerDesktop1.txt
C:UsersGhadeerDesktop2.txt
Scanner class: P.12
The End
ghadeer-al-hasan ghadeerof@gamil.comghadeer-al-hasan ghadeer.al.hasan.95@gmail.com

[Java] #7 - Input & Output Stream