The character stream or textual I/O classes deals with reading characters or writing characters to a target or destination stream. They can be used for reading or writing characters to text-based files like XML, HTML, JSON etc.
The character stream abstract base classes are Reader and Writer. The input character stream class hierarchy is shown in the below figure.
The description of these input character stream classes is provided in the below table:
Stream class | Description |
Reader | This is an abstract base class for all input character stream classes. |
BufferedReader | An input character stream class which is faster than other input stream classes. |
CharArrayReader | An input character stream class for reading array of characters as an input stream. |
FilterReader | An abstract character byte stream class for filtering character input streams. |
InputStreamReader | An input character stream class for converting input byte stream to characters. |
PipedReader | An input character stream class for reading characters from a pipe. |
StringReader | An input character stream class for reading characters from a string as input stream. |
PushBackReader | An input character stream class which can be used to look ahead in the character input stream. |
FileReader | An input character stream class for reading characters from a file. |
Visit the following link for sample Java programs for reading characters from a file using character stream classes like BufferedReader and FileReader.
The output character stream class hierarchy is shown in the below figure.
The description of these Output character stream classes is provided in the below table:
Stream class | Description |
Writer | This is an abstract base class for all output character stream classes. |
BufferedWriter | An output character stream class which is faster than other output stream classes. |
CharArrayWriter | An output character stream class for writing array of characters as an output stream. |
FilterWriter | An abstract character byte stream class for filtering character output streams. |
OutputStreamWriter | An output character stream class for converting character to output byte stream. |
PipedWriter | An output character stream class for writing characters to a pipe. |
StringWriter | An output character stream class for writing characters to a string as output stream. |
FileWriter | An output character stream class for Writing characters to a file. |
Visit the following link for sample Java programs for writing characters to a file using character stream classes like BufferedWriter and FileWriter.
For more information, visit the following links:
Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.
Leave a Reply