Topics Index

Input/Output: Exploring > Character Streams >
Siva Nookala - 15 Apr 2016
Writer is an abstract class in Java. It is useful in writing character streams. The methods that a subclass must implement are write(char[], int, int), flush(), and close(). However some of the sub classes override some of the methods defined by Writer to provide higher efficiency, additional functionality, or both.

The sub classes of Writer are Java BufferedWriter, Java CharArrayWriter, FilterWriter, Java FileWriter, PrintWriter Class In Java,PipedWriter, StringWriter
Important Methods :
Method Description
void write(int c) Writes a single character.
void write(char[] cbuf) Writes an array of characters.
void write(String str) Writes a string.
Writer    append(char c) Appends the specified character to this writer.
Writer append(CharSequence csq) Appends the specified character sequence to this writer.
abstract void close() Closes the stream, flushing it first.
abstract void flush() Flushes the stream.
Rest Of Methods :
Method Description
void write(String str, int off, int len) Writes a portion of a string.
abstract void write(char[] cbuf, int off, int len) Writes a portion of an array of characters.
Writer append(CharSequence csq, int start, int end) Appends a subsequence of the specified character sequence to this writer.

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App