0% found this document useful (0 votes)
24 views

Basic I/O in Java: Stream To Make I/O Operations Fast. A Stream Is A Sequence of Data. in Java, A

The document discusses basic I/O in Java. It describes how the java.io package provides classes for input and output operations through data streams, serialization, and file system operations. It defines I/O streams as representing input sources or output destinations that can be disk files, devices, programs, or memory arrays. Streams support different data types and can pass or transform data. Programs use input streams to read from a source one item at a time and output streams to write to a destination one item at a time, with byte streams specifically used for input/output of 8-bit bytes.

Uploaded by

Iftekharul Islam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Basic I/O in Java: Stream To Make I/O Operations Fast. A Stream Is A Sequence of Data. in Java, A

The document discusses basic I/O in Java. It describes how the java.io package provides classes for input and output operations through data streams, serialization, and file system operations. It defines I/O streams as representing input sources or output destinations that can be disk files, devices, programs, or memory arrays. Streams support different data types and can pass or transform data. Programs use input streams to read from a source one item at a time and output streams to write to a destination one item at a time, with byte streams specifically used for input/output of 8-bit bytes.

Uploaded by

Iftekharul Islam
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Basic I/O in Java

The java.io package contains all the classes required for input and output
operations. Java.io package provides for system input and output through

 Data streams
- It first focuses on I/O Streams, a powerful concept that greatly simplifies
I/O operations
 Serialization and
- Then it also looks at serialization, which lets a program write whole
objects out to streams and read them back again
 The file system
- It also looks at file I/O and file system operations, including random
access files

Java I/O (Input and Output) is used to process the input and produce the output.
We can perform file handling in java by Java I/O API. Java uses the concept of the
stream to make I/O operations fast. A stream is a sequence of data. In Java, a
stream is composed of bytes. It's called a stream because it is like a stream of
water that continues to flow.

I/O Streams: An I/O Stream represents an input source or an output destination.


A stream can represent many different kinds of sources and destinations, including
disk files, devices, other programs, and memory arrays.

Streams support many different kinds of data, including

 Simple bytes
 Primitive data types
 Localized characters and
 Objects

Some streams simply pass on data; others manipulate and transform the data in
useful ways.

No matter how they work internally, all streams present the same simple model to
programs that use them: A stream is a sequence of data. A program uses an input
stream to read data from a source, one item at a time:
A program uses an output stream to write data to a destination, one item at time:

1) Byte Streams: Programs use byte streams to perform input and output of
8-bit bytes. All byte stream classes are descended from InputStream and
OutputStream. There are many byte stream classes. We'll focus on the file
I/O byte streams, FileInputStream and FileOutputStream.

You might also like