java.io.FilterWriter
java.io.Writer
None
None
New as of JDK 1.1
The FilterWriter class is the superclass of all of the writer classes that filter output. A subclass of FilterWriter works by wrapping an existing writer, called the underlying writer, and providing additional functionality. The methods of FilterWriter simply override the methods of Writer with versions that call the corresponding methods of the underlying writer.
FilterWriter cannot be instantiated directly; it must be subclassed. An instance of a subclass of FilterWriter is constructed with another Writer object. The methods of a subclass of FilterWriter should override some methods in order to extend their behavior or provide some sort of filtering.
FilterWriter is like FilterOutputStream, except that it deals with a character stream instead of a byte stream.
public abstract class java.io.FilterWriter extends java.io.Writer { // Variables protected Writer out; // Constructors protected FilterWriter(Writer out); // Instance Methods public void close(); public void flush(); public void write(int c); public void write(char[] cbuf, int off, int len); public void write(String str, int off, int len); }
The underlying writer that this FilterWriter wraps or filters.
The output writer to filter.
This constructor creates a FilterWriter that sends data to out.
If any kind of I/O error occurs.
Writer.close()
This method calls the close() method of the underlying writer, which releases any system resources associated with this object.
If any kind of I/O error occurs.
Writer.flush()
This method calls the flush() method of the underlying writer, which forces any characters that may be buffered by this FilterWriter to be written to the underlying device.
The value to write.
If any kind of I/O error occurs.
Writer.write(int)
This method writes a character containing the low-order 16 bits of the given integer value. It calls the write(int) method of the underlying writer.
public void write(char[] cbuf, int off, int len) throws IOException
An array of characters to write to the stream.
An offset into the array.
The number of characters to write.
If any kind of I/O error occurs.
Writer.write(char[], int, int)
This method writes len characters contained in the given array, starting at offset off. It does this by calling the write(char[], int, int) method of the underlying writer.
A string to write to the stream.
An offset into the string.
The number of characters to write.
If any kind of I/O error occurs.
Writer.write(String, int, int)
This method writes len characters contained in the given string, starting at offset off. It does this by calling the write(String, int, int) method of the underlying writer.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
FilterOutputStream, IOException, String, Writer