The Java.io.Writer class is a abstract class for writing to character streams.
Following is the declaration for Java.io.Writer class −
public abstract class Writer extends Object implements Appendable, Closeable, Flushable
Following are the fields for Java.io.Writer class −
protected Object lock − This is the object used to synchronize operations on this stream.
|S.N.||Constructor & Description|
This creates a new character-stream writer whose critical sections will synchronize on the writer itself.
protected Writer(Object lock)
This creates a new character-stream writer whose critical sections will synchronize on the given object.
|S.N.||Method & Description|
|1||Writer append(char c)
This method appends the specified character to this writer.
|2||Writer append(CharSequence csq)
This method appends the specified character sequence to this writer.
|3||Writer append(CharSequence csq, int start, int end)
This method appends a subsequence of the specified character sequence to this writer.
|4||abstract void close()
This method loses the stream, flushing it first.
|5||abstract void flush()
This method flushes the stream.
|6||void write(char cbuf)
This method writes an array of characters.
|7||abstract void write(char cbuf, int off, int len)
This method writes a portion of an array of characters.
|8||void write(int c)
This method writes a single character.
|9||void write(String str)
This method writes a string.
|10||void write(String str, int off, int len)
This method writes a portion of a string.
This class inherits methods from the following classes −