Skip to content

Most visited

Recently visited

navigation
Added in API level 1

FilterWriter

public abstract class FilterWriter
extends Writer

java.lang.Object
   ↳ java.io.Writer
     ↳ java.io.FilterWriter


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.

See also:

Summary

Fields

protected Writer out

The Writer being filtered.

Inherited fields

From class java.io.Writer

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.

Inherited methods

From class java.io.Writer
From class java.lang.Object
From interface java.lang.Appendable
From interface java.io.Closeable
From interface java.io.Flushable
From interface java.lang.AutoCloseable

Fields

out

Added in API level 1
Writer out

The Writer being filtered.

Protected constructors

FilterWriter

Added in API level 1
FilterWriter (Writer out)

Constructs a new FilterWriter on the Writer out. All writes are now filtered through this writer.

Parameters
out Writer: the target Writer to filter writes on.

Public methods

close

Added in API level 1
void close ()

Closes this writer. This implementation closes the target writer.

Throws
IOException if an error occurs attempting to close this writer.

flush

Added in API level 1
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.

write

Added in API level 1
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 char: the buffer to write.
offset int: the index of the first character in buffer to write.
count int: the number of characters in buffer to write.
Throws
IOException if an error occurs while writing to this writer.

write

Added in API level 1
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 String: the string to be written.
offset int: the index of the first character in str to write.
count int: the number of chars in str to write.
Throws
IOException if an error occurs while writing to this writer.

write

Added in API level 1
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 int: the char to write to the target writer.
Throws
IOException if an error occurs while writing to this writer.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.