• Byte stream class
• character stream class
1. ByteStream classes are used to read bytes from the input
stream and write bytes to the output stream
2 . We can store video, audio, characters, etc., by using
ByteStream classes.
Byte Stream
Class 3.These classes are part of the java.io package.
4.The ByteStream classes are divided into two types of classes
1.InputStream
2.OutputStream
1. The InputStream class provides methods to read
bytes from a file, console or memory. The subclasses
of InputStream class are given in the following table.
1. BufferedInputStream
INPUT This class provides
methods to read bytes
STREAM from the buffer.
CLASS
2. BytearrayInputstream This class provides methods to
read bytes from the byte
array.
3. Datainputstream This class provides methods to read Java primitive
data types.
4. Fileinputstream This class contains methods to read bytes from
the other input streams, which are used as the
primary source of data
5. Objectinputstream This class provides methods to read objects.
6.Fliterinputstream This class contains methods to read bytes
from the other input streams, which are
used as the primary source of data.
7. Pipedinputstream This class provides methods to read from a
piped output stream to which the piped input
stream must be connected
The OutputStream is an abstract class that is used to write 8-bit
bytes to the stream
• It is inherited by various subclasses that are given in the following
table.
Output Stream
Class 1.Bufferedoutputstream This class provides methods to write the
bytes to the buffer.
2.Bytearrayoutputstream. This class provides methods to
write bytes to the byte array
3.Dataoutputstream This class provides methods to
write the java primitive data types.
4.fileoutputstream This class provides methods to
write bytes to a file.
5. filteroutputstream This class provides methods to
write to other output streams.
6.objectoutstream This class provides methods to write
objects.
7.pipedoutstream It provides methods to write bytes to a
piped output stream
The java.io package provides CharacterStream classes to overcome the
limitations of ByteStream classes, which can only handle the 8-bit bytes
and is not compatible to work directly with the Unicode characters.
• CharacterStream classes are used to work with 16-bit Unicode characters.
• They can perform operations on characters, char arrays and Strings.
Character • The CharacterStream classes are divided into two types of classes
Stream Classes 1. Reader class
2. Writer class.
Reader Class
• Reader class is used to read the 16-bit characters from the input stream.
• All methods of the Reader class throw an IOException.
1.Bufferedreader This class provides methods to read characters
from the buffer.
2.charArrayreader This class provides methods to read
characters from the char array.
3.filereader This class provides methods to
read characters from the file.
4.filterreader This class provides methods to read
characters from the underlying
character input stream.
5.Inputstreamreader This class provides methods to convert
bytes to characters
6.pipedreader This class provides methods to read
characters from the connected piped
output stream.
Writer class is used to write 16-bit Unicode characters to the
output stream.
• The methods of the Writer class generate IOException.
Writer Class