CHAPTER 22: The Package java.io Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

22.19 The Class java.io.FilterOutputStream

22.19.1 out , 22.19.2 FilterOutputStream , 22.19.3 write , 22.19.4 write , 22.19.5 write , 22.19.6 flush , 22.19.7 close

A FilterOutputStream contains some other output stream, which it uses as its basic sink of data, possibly transforming the data along the way or providing additional functionality. The class FilterOutputStream itself simply overrides all methods of OutputStream with versions that pass all requests to the contained output stream. Subclasses of FilterOutputStream may further override some of these methods and may also provide additional methods and fields.

public class FilterOutputStream extends OutputStream {
	protected OutputStream out;
	public FilterOutputStream(OutputStream out);
	public void write(int b) throws IOException;
	public void write(byte[] b)
		throws IOException, NullPointerException;
	public void write(byte[] b, int off, int len)
		throws IOException, NullPointerException,
			IndexOutOfBoundsException;
	public void flush() throws IOException;
	public void close() throws IOException;
}


22.19.1 out

protected OutputStream out;

The output stream to be filtered.


22.19.2 FilterOutputStream

public FilterOutputStream(OutputStream out)

This constructor initializes a newly created FilterInputStream by assigning the argument out to the field this.out so as to remember it for later use.


22.19.3 write

public void write(int b) throws IOException

This method simply performs out.write(b).

Implements the abstract write method of OutputStream (S22.15.1).


22.19.4 write

public void write(byte[] b)
	throws IOException, NullPointerException

This method simply performs out.write(b).

Overrides the write method of OutputStream (S22.15.2).


22.19.5 write

public void write(byte[] b, int off, int len)
	throws IOException, NullPointerException,       IndexOutOfBoundsException

This method simply performs out.write(b, off, len).

Overrides the write method of OutputStream (S22.15.3).


22.19.6 flush

public void flush() throws IOException

This method simply performs out.flush().

Overrides the flush method of OutputStream (S22.15.4).


22.19.7 close

public void close() throws IOException

This method simply performs out.close().

Overrides the close method of OutputStream (S22.15.5).

Top© 1996 Sun Microsystems, Inc. All rights reserved.