0% found this document useful (0 votes)
7 views2 pages

Java IO Notes

The Java I/O package is essential for processing input and output using streams, which enhance the speed of I/O operations. It consists of two main types of streams: byte streams for raw binary data and character streams for character data, each with specific classes for handling files. Important classes include InputStream, OutputStream, Reader, Writer, and various file handling classes like FileInputStream and FileReader.

Uploaded by

anup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Java IO Notes

The Java I/O package is essential for processing input and output using streams, which enhance the speed of I/O operations. It consists of two main types of streams: byte streams for raw binary data and character streams for character data, each with specific classes for handling files. Important classes include InputStream, OutputStream, Reader, Writer, and various file handling classes like FileInputStream and FileReader.

Uploaded by

anup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Java I/O Package - Complete Notes

Java I/O (Input and Output) is used to process the input and produce the output.

Java uses the concept of streams to make I/O operations fast. The java.io package contains all the

classes required for input and output operations.

Two types of Streams:

1. Byte Streams - handle I/O of raw binary data.

2. Character Streams - handle I/O of character data, automatically handling character encoding and

decoding.

Byte Stream Classes


Byte streams use InputStream and OutputStream as base classes.

Common classes include:

- FileInputStream

- FileOutputStream

- BufferedInputStream

- BufferedOutputStream

- DataInputStream

- DataOutputStream

Image not found: /mnt/data/byte_stream_hierarchy.png

Character Stream Classes


Character streams use Reader and Writer as base classes.

Common classes include:

- FileReader

- FileWriter

- BufferedReader

- BufferedWriter
- PrintWriter

Image not found: /mnt/data/character_stream_hierarchy.png

File I/O with Constructors


FileInputStream fis = new FileInputStream("input.txt");

FileOutputStream fos = new FileOutputStream("output.txt");

FileReader fr = new FileReader("input.txt");

FileWriter fw = new FileWriter("output.txt");

Important Classes and Interfaces in java.io


- InputStream / OutputStream

- Reader / Writer

- File

- Serializable

- BufferedReader / BufferedWriter

- PrintStream / PrintWriter

- ObjectInputStream / ObjectOutputStream

You might also like