Java Writer Class

Category: Java   Tags: Java, Java File Handling, Java Character Stream Class, Java Writer Class

Writer is an abstract class for writing to character streams. Writer has this declaration:

                                    public abstract class Writer
                                    extends Object
                                    implements Appendable, Closeable, Flushable
                                

Constructors

protected Writer()
Creates a new character-stream writer. Its critical sections will synchronize on the writer itself.
protected Writer(Object obj)
Creates a new character-stream writer. Its critical sections will synchronize on the given object obj

Methods

public void write(int c) throws IOException
Writes a single character to the invoking output stream.
public void write(char[] c) throws IOException
Writes an array of characters to the invoking output stream.
public void write(char[] c, int offset, int num) throws IOException
Writes num character from the specified character array starting at offset to this file output stream.
public void write(String s) throws IOException
Writes a string s to the invoking output stream.
public Writer append(char c) throws IOException
It appends c to the end of the invoking output stream. and returns a reference to the invoking stream.
public void flush() throws IOException
Flushes this output stream and forces any buffered characters to be written out.
public void close() throws IOException
Closes this stream and releases any system resources associated with the stream. Further write attempts will generate an IOException.