Presented By:
Pratiksha
Sharma
B.C.A. 2
nd Year
Presented To:
Apurva omer
Content:-
•Input / Output in Java
•Stream
•types of streams
•Byte stream
•Character stream
•Standard Streams
Input / Output in Java
● Programs read inputs from data sources (e.g.,
keyboard, file, network, memory buffer, or another
program) and write outputs to data sinks (e.g., display
console,file, network, memory buffer, or another
program).
● Java I/O (Input and Output) is used to process the input
and produce the output.
● Java uses the concept of stream to make I/O operation
fast.
The java.io package is used for java i/o (file handling).
Stream
•A stream can be defined as a sequence of data.
•A stream is an object that either delivers data to its
destination (screen, file, etc.) or that takes data from a
source (keyboard, file, etc.)
Stream cont..
•There are two kinds of Streams −
○ Input Stream − The Input Stream is used to read data
from a source.
○ Output Stream − The Output Stream is used for writing
data to a destination.
Continue…
● Java defines two types of streams. They are,
○ Byte Stream : It provides a convenient means
for handling input and output of byte.
○ Character Stream : It provides a convenient
means for handling input and output of
characters.
types of streams
•There are two types of streams :
•Byte Streams
•Character Streams
Byte stream
•Byte stream have been designed to provide functional
features for creating and manipulating streams and
files for reading and writing bytes.
•Bytes can transmit in only one direction.
•Byte streams create binary files.
•Binary files are faster to read and write because no
translation need take place.
Character stream
•Character streams can be used to read and
write 16-bit Unicode characters.
•Character streams create text files.
•Two kinds of character stream classes-
Standard Streams
Java provides the following three standard streams −
•Standard Input − This is used to feed the data to user's
program and usually a keyboard is used as standard input
stream and represented as System.in.
•Standard Output − This is used to output the data produced
by the user's program and usually a computer screen is used
for standard output stream and represented as System.out.
•Standard Error − This is used to output the error data
produced by the user's program and usually a computer
screen is used for standard error stream and represented
as System.err.