Build 1.0_r1(from source)

java.io
Class FilterWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public abstract class FilterWriter
extends Writer

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.

See Also:
FilterWriter

Field Summary
protected  Writer out
          The Writer being filtered.
 
Fields inherited from class java.io.Writer
lock, TOKEN_NULL
 
Constructor Summary
protected FilterWriter(Writer out)
          Constructs a new FilterWriter on the Writer out.
 
Method Summary
 void close()
          Close this FilterWriter.
 void flush()
          Flush this FilteredWriter to ensure all pending data is sent out to the target Writer.
 void write(char[] buffer, int offset, int count)
          Writes count chars from the char array buffer starting at offset index to this FilterWriter.
 void write(int oneChar)
          Writes the specified char oneChar to this FilterWriter.
 void write(String str, int offset, int count)
          Writes count chars from the String str starting at offset index to this FilterWriter.
 
Methods inherited from class java.io.Writer
append, append, append, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected Writer out
The Writer being filtered.

Constructor Detail

FilterWriter

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.
Method Detail

close

public void close()
           throws IOException
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.

Specified by:
close in interface Closeable
Specified by:
close in class Writer
Throws:
IOException - If an error occurs attempting to close this FilterWriter.

flush

public void flush()
           throws IOException
Flush this FilteredWriter to ensure all pending data is sent out to the target Writer. This implementation flushes the target Writer.

Specified by:
flush in interface Flushable
Specified by:
flush in class Writer
Throws:
IOException - If an error occurs attempting to flush this FilterWriter.

write

public void write(char[] buffer,
                  int offset,
                  int count)
           throws IOException
Writes count chars from the char array buffer starting at offset index to this FilterWriter. This implementation writes the buffer to the target Writer.

Specified by:
write in class 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.

write

public void write(int oneChar)
           throws IOException
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.

Overrides:
write in class Writer
Parameters:
oneChar - the char to be written
Throws:
IOException - If an error occurs attempting to write to this FilterWriter.

write

public void write(String str,
                  int offset,
                  int count)
           throws IOException
Writes count chars from the String str starting at offset index to this FilterWriter. This implementation writes the str to the target Writer.

Overrides:
write in class 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.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature