Outlines of this lecture:
- What is stream?
- File Output Stream Class
- File Input Stream Class
- Byte Array Output Stream Class
- Sequence Input Stream Class
- File Reader Class
- File Writer Class
- Scanner with String
Size: 1.36 MB
Language: en
Added: Jun 20, 2020
Slides: 13 pages
Slide Content
P.1 Ghadeer Al Hasan Input & Output Stream ghadeer -al- hasan g [email protected]
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.
SequenceInputStream class: P.9 Is used to read data from multiple stream. It reads data of stream one by one. C:\\Users\\Ghadeer\\Desktop\\2.txt C:\\Users\\Ghadeer\\Desktop\\1.txt
FileReader & FileWriter class: P.11 Are used to write and read data from text files. There are character-oriented classed. C:\\Users\\Ghadeer\\Desktop\\1.txt C:\\Users\\Ghadeer\\Desktop\\2.txt