Top Description Fields Constructors Methods
java.io

public abstract Class FilterWriter

extends Writer
Class Inheritance

Abstract class for writing filtered character streams. The abstract class FilterWriter itself provides default methods that pass all requests to the contained stream. Subclasses of FilterWriter should override some of these methods and may also provide additional methods and fields.
Author
Mark Reinhold
Since
1.1

Field Summary

Modifier and TypeField and Description
protected Writer
out

The underlying character-output stream.

Inherited from java.io.Writer:
lock

Constructor Summary

AccessConstructor and Description
protected
FilterWriter(Writer
a Writer object to provide the underlying stream.
out
)

Create a new filtered writer.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Closes the stream, flushing it first.

public void
flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Flushes the stream.

public void
write(int
int specifying a character to be written
c
)

Overrides java.io.Writer.write.

Writes a single character.

public void
write(char[]
Buffer of characters to be written
cbuf
,
int
Offset from which to start reading characters
off
,
int
Number of characters to be written
len
)

Implements abstract java.io.Writer.write.

Writes a portion of an array of characters.

public void
write(String
String to be written
str
,
int
Offset from which to start reading characters
off
,
int
Number of characters to be written
len
)

Overrides java.io.Writer.write.

Writes a portion of a string.

Inherited from java.io.Writer:
appendappendappendnullWriterwritewrite

Field Detail

outback to summary
protected Writer out

The underlying character-output stream.

Constructor Detail

FilterWriterback to summary
protected FilterWriter(Writer out)

Create a new filtered writer.

Parameters
out:Writer

a Writer object to provide the underlying stream.

Exceptions
NullPointerException:
if out is null

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Doc from java.io.Writer.close.

Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.

Exceptions
IOException:
If an I/O error occurs
flushback to summary
public void flush() throws IOException

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Flushes the stream.

Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(int c) throws IOException

Overrides java.io.Writer.write.

Writes a single character.

Parameters
c:int

Doc from java.io.Writer.write.

int specifying a character to be written

Exceptions
IOException:
If an I/O error occurs
writeback to summary
public void write(char[] cbuf, int off, int len) throws IOException

Implements abstract java.io.Writer.write.

Writes a portion of an array of characters.

Parameters
cbuf:char[]

Buffer of characters to be written

off:int

Offset from which to start reading characters

len:int

Number of characters to be written

Exceptions
IOException:
If an I/O error occurs
IndexOutOfBoundsException:
If the values of the off and len parameters cause the corresponding method of the underlying Writer to throw an IndexOutOfBoundsException
writeback to summary
public void write(String str, int off, int len) throws IOException

Overrides java.io.Writer.write.

Writes a portion of a string.

Parameters
str:String

String to be written

off:int

Offset from which to start reading characters

len:int

Number of characters to be written

Exceptions
IOException:
If an I/O error occurs
IndexOutOfBoundsException:
If the values of the off and len parameters cause the corresponding method of the underlying Writer to throw an IndexOutOfBoundsException