Writer

Writer is the abstract class for writing to character streams.

The following table lists all Writer and Reader classes.

BufferedReader
Buffered input character stream
BufferedWriter
Buffered output character stream
CharArrayReader
Input stream that reads from a character array
CharArrayWriter
Output stream that writes to a character array
FileReader
Input stream that reads from a file
FileWriter
Output stream that writes to a file
FilterReader
Filtered reader
FilterWriter
Filtered writer
InputStreamReader
Input stream that translates bytes to characters
LineNumberReader
Input stream that counts lines
OutputStreamWriter
Output stream that translates characters to bytes
PipedReader
Input pipe
PipedWriter
Output pipe
PrintWriter
Output stream that contains print( ) and println( )
PushbackReader
Input stream that allows characters to be returned to the input stream
Reader
Abstract class that describes character stream input
StringReader
Input stream that reads from a string
StringWriter
Output stream that writes to a string
Writer
Abstract class that describes character stream output

Methods defined by Writer:

Writer append(char c)
Appends the specified character to this writer.
Writer append(CharSequence csq)
Appends the specified character sequence to this writer.
Writer append(CharSequence csq, int start, int end)
Appends a subsequence of the specified character sequence to this writer.
abstract void close()
Closes the stream, flushing it first.
abstract void flush()
Flushes the stream.
void write(char[] cbuf)
Writes an array of characters.
abstract void write(char[] cbuf, int off, int len)
Writes a portion of an array of characters.
void write(int c)
Writes a single character.
void write(String str)
Writes a string.
void write(String str, int off, int len)
Writes a portion of a string.

Revised from Open JDK source code

Home 
  Java Book 
    File Stream