Skip to content

Most visited

Recently visited

navigation
Added in API level 1

FilterOutputStream

public class FilterOutputStream
extends OutputStream

java.lang.Object
   ↳ java.io.OutputStream
     ↳ java.io.FilterOutputStream
Known Direct Subclasses
Known Indirect Subclasses


Wraps an existing OutputStream 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 stream. Output streams that wrap another output stream and provide some additional functionality on top of it usually inherit from this class.

See also:

Summary

Fields

protected OutputStream out

The target output stream for this filter stream.

Public constructors

FilterOutputStream(OutputStream out)

Constructs a new FilterOutputStream with out as its target stream.

Public methods

void close()

Closes this stream.

void flush()

Ensures that all pending data is sent out to the target stream.

void write(byte[] buffer, int offset, int length)

Writes count bytes from the byte array buffer starting at offset to the target stream.

void write(int oneByte)

Writes one byte to the target stream.

Inherited methods

From class java.io.OutputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable
From interface java.lang.AutoCloseable

Fields

out

Added in API level 1
OutputStream out

The target output stream for this filter stream.

Public constructors

FilterOutputStream

Added in API level 1
FilterOutputStream (OutputStream out)

Constructs a new FilterOutputStream with out as its target stream.

Parameters
out OutputStream: the target stream that this stream writes to.

Public methods

close

Added in API level 1
void close ()

Closes this stream. This implementation closes the target stream.

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

flush

Added in API level 1
void flush ()

Ensures that all pending data is sent out to the target stream. This implementation flushes the target stream.

Throws
IOException if an error occurs attempting to flush this stream.

write

Added in API level 1
void write (byte[] buffer, 
                int offset, 
                int length)

Writes count bytes from the byte array buffer starting at offset to the target stream.

Parameters
buffer byte: the buffer to write.
offset int: the index of the first byte in buffer to write.
length int: the number of bytes in buffer to write.
Throws
IndexOutOfBoundsException if offset < 0 or count < 0, or if offset + count is bigger than the length of buffer.
IOException if an I/O error occurs while writing to this stream.

write

Added in API level 1
void write (int oneByte)

Writes one byte to the target stream. Only the low order byte of the integer oneByte is written.

Parameters
oneByte int: the byte to be written.
Throws
IOException if an I/O error occurs while writing to this stream.
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.