java.io
public
abstract
class
java.io.FilterWriter
FilterWriter is a class which takes a Writer and filters the
output in some way. The filtered view may be a buffered output or one which
compresses data before actually writing the bytes.
Summary
Fields
| protected |
|
|
Writer |
out |
The Writer being filtered. |
| protected |
|
|
Object |
lock |
The object used to synchronize access to the writer. |
Protected Constructors
Public Methods
Methods inherited
from class
java.io.Writer
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Fields
protected
Writer
out
The Writer being filtered.
Protected Constructors
protected
FilterWriter(Writer out)
Constructs a new FilterWriter on the Writer
out. All
writes are now filtered through this Writer.
Parameters
| out
| the target Writer to filter writes on.
|
Public Methods
public
void
close()
Close this FilterWriter. Closes the Writer
out by default.
This will close any downstream Writers as well. Any additional processing
required by concrete subclasses should be provided in their own
close implementation.
Throws
| IOException
| If an error occurs attempting to close this FilterWriter.
|
public
void
flush()
Flush this FilteredWriter to ensure all pending data is sent out to the
target Writer. This implementation flushes the target Writer.
Throws
| IOException
| If an error occurs attempting to flush this FilterWriter.
|
public
void
write(char[] buffer, int offset, int count)
Writes
count chars from the char array
buffer starting at offset
index to this
FilterWriter. This implementation writes the
buffer to the
target Writer.
Parameters
| buffer
| the buffer to be written |
| offset
| offset in buffer to get chars |
| count
| number of chars in buffer to write |
Throws
| IOException
| If an error occurs attempting to write to this FilterWriter.
|
public
void
write(String str, int offset, int count)
Writes
count chars from the String
str starting at offset
index to this
FilterWriter. This implementation writes the
str to the
target Writer.
Parameters
| str
| the String to be written. |
| offset
| offset in str to get chars. |
| count
| number of chars in str to write. |
Throws
| IOException
| If an error occurs attempting to write to this FilterWriter.
|
public
void
write(int oneChar)
Writes the specified char
oneChar to this FilterWriter.
Only the 2 low order bytes of
oneChar is written. This
implementation writes the char to the target Writer.
Parameters
| oneChar
| the char to be written |
Throws
| IOException
| If an error occurs attempting to write to this FilterWriter.
|