Presented By: Fayiza Beegam.P
Presented By: Fayiza Beegam.P
FAYIZA BEEGAM.P
CHARACTER STREAM CLASSES
The java platform stores character values using
Unicode conventions.
Character stream I/O automatically translates this
internal format to and form the local character set.
Character streams are defined by using two class
hierarchies.
At the top are two abstract classes, Reader and writer
class.
These abstract classes handle Unicode character
streams.
READER CLASSES
Reader classes are used to read 16-bit Unicode
characters from the input stream.
Superclass for all character-oriented input stream
classes.
Being an abstract class, Reader class cannot be
instantiated hence it’s subclasses are used.
All methods of this class throw an I/O Exception.
Class Description
Buffered Reader Contains methods to read
characters from the buffer
CharArrayReader Contains methods to read
characters from a character array
FileReader Contains methods to read from a
file
FilterReader Contains methods to read from
underlying character –input stream
InputStreamReader Contains methods to convert byte to
characters
PipedReader Contains methods to read from the
connected piped output stream
StringReader Contains methods to read from a
string
Methods Description
voidwrite() Write data to the output
stream
Voidwrite(int i) Write a single characters to the
output stream
Voidwrite(char buffer[]) Write an array of characters to
the output stream
void write(char buffer[],int Writes ‘n’ characters from the
loc,int nChars) buffer starting at buffer[loc] to
the output stream
Writer classes are used to write 16-bit Unicode
characters onto an output stream.
The writer classes is the superclass for all character-
oriented output stream classes.
All the methods of this class throw an I/O
Eexception.
Being an abstract class, the writer class cannot be
instantiated hence,it’s subclasses are used.
Class Description
Method Description
Void write() Writes data to the stream
Void write(int i) Write a single character to
the output stream
Void write(char buffer[]) Writes an array of
characters to the output
stream
Void write(char buffer[],int Write ’n’ characters from
loc,int nChars) the buffer starting at
buffer[loc] to the output
stream
Void close() Close the output stream
Void flush() Flushes the output stream
and writes the waiting
buffered output characters
Using BufferedWriter class:-
The BufferedReader class,an output counterpart of
the BufferedReader,is used to write characters onto
the character-output stream.
The BufferReader object can be created one of the
following two constructors.
a) BufferedWriter(writer outStream)
b) BufferedWriter(writer outStream, int n Chars)
The first constuctor creates a buffered character
stream that uses an input buffer of size nChars.
THANKS