Class Overview
Wraps an existing Writer
and performs some transformation on the
output data while it is being written. Transformations can be anything from a
simple byte-wise filtering output data to an on-the-fly compression or
decompression of the underlying writer. Writers that wrap another writer and
provide some additional functionality on top of it usually inherit from this
class.
Summary
Fields |
protected
Writer |
out |
The Writer being filtered. |
Protected Constructors |
|
FilterWriter(Writer out)
Constructs a new FilterWriter on the Writer out .
|
Public Methods |
void
|
close()
Closes this writer.
|
void
|
flush()
Flushes this writer to ensure all pending data is sent out to the target
writer.
|
void
|
write(char[] buffer, int offset, int count)
Writes count characters from the char array buffer
starting at position offset to the target writer.
|
void
|
write(String str, int offset, int count)
Writes count characters from the string str starting at
position index to this writer.
|
void
|
write(int oneChar)
Writes the specified character oneChar to the target writer.
|
[Expand]
Inherited Methods |
From class
java.io.Writer
Writer
|
append(CharSequence csq)
Appends the character sequence csq to the target.
|
Writer
|
append(CharSequence csq, int start, int end)
Appends a subsequence of the character sequence csq to the
target.
|
Writer
|
append(char c)
Appends the character c to the target.
|
abstract
void
|
close()
Closes this writer.
|
abstract
void
|
flush()
Flushes this writer.
|
void
|
write(char[] buf)
Writes the entire character buffer buf to the target.
|
void
|
write(String str)
Writes the characters from the specified string to the target.
|
abstract
void
|
write(char[] buf, int offset, int count)
Writes count characters starting at offset in buf
to the target.
|
void
|
write(String str, int offset, int count)
Writes count characters from str starting at offset to the target.
|
void
|
write(int oneChar)
Writes one character to the target.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
From interface
java.io.Flushable
abstract
void
|
flush()
Flushes the object by writing out any buffered data to the underlying
output.
|
|
From interface
java.lang.Appendable
|
From interface
java.lang.AutoCloseable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
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
()
Closes this writer. This implementation closes the target writer.
Throws
IOException
| if an error occurs attempting to close this writer.
|
public
void
flush
()
Flushes this writer 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 writer.
|
public
void
write
(char[] buffer, int offset, int count)
Writes count
characters from the char array buffer
starting at position offset
to the target writer.
Parameters
buffer
| the buffer to write. |
offset
| the index of the first character in buffer to write. |
count
| the number of characters in buffer to write. |
Throws
IOException
| if an error occurs while writing to this writer.
|
public
void
write
(String str, int offset, int count)
Writes count
characters from the string str
starting at
position index
to this writer. This implementation writes
str
to the target writer.
Parameters
str
| the string to be written. |
offset
| the index of the first character in str to write. |
count
| the number of chars in str to write. |
Throws
IOException
| if an error occurs while writing to this writer.
|
public
void
write
(int oneChar)
Writes the specified character oneChar
to the target writer. Only the
two least significant bytes of the integer oneChar
are written.
Parameters
oneChar
| the char to write to the target writer. |
Throws
IOException
| if an error occurs while writing to this writer.
|