Reader, writer, FileReader, FileWriter, BufferedReader, BufferedWriter

Filter Course


Reader, writer, FileReader, FileWriter, BufferedReader, BufferedWriter

Published by: Dikshya

Published date: 02 Jul 2023

Reader, writer, FileReader, FileWriter, BufferedReader, BufferedWriter

Reader: A reader is an interface in Java that provides methods for reading data from a source. It is an abstract class that forms the basis for various specific types of readers, such as InputStreamReader and FileReader. Readers are used to read character-based data from streams or files.

Writer: A writer is an interface in Java that provides methods for writing data to a destination. It is an abstract class that forms the basis for various specific types of writers, such as OutputStreamWriter and FileWriter. Writers are used to write character-based data to streams or files.

FileReader: FileReader is a class in Java that extends the InputStreamReader class and is used to read character-based data from a file. It reads the contents of a file in a character-by-character manner, allowing you to read text files easily.

FileWriter: FileWriter is a class in Java that extends the OutputStreamWriter class and is used to write character-based data to a file. It allows you to write text data to a file in a character-by-character manner, making it useful for writing text files.

BufferedReader: BufferedReader is a class in Java that extends the Reader class and provides buffering capabilities, which improves efficiency when reading data from a stream. It reads data from a character stream and stores it in an internal buffer, allowing you to read larger chunks of data at once instead of reading one character at a time.

BufferedWriter: BufferedWriter is a class in Java that extends the Writer class and provides buffering capabilities, similar to BufferedReader. It writes data to a character stream and stores it in an internal buffer, allowing you to write larger chunks of data at once instead of writing one character at a time. BufferedWriters are useful when you need to improve the efficiency of writing data to a stream or file.