public abstract class FilterOutputStream2 extends OutputStream
FilterOutputStream2 contains another
OutputStream, which it uses as its basic
source of data, possibly transforming the data along the
way or providing additional functionality.
Note: unlike FilterOutputStream this class
delegates every method by default. This means to transform
write calls, you need to override multiple methods.
On the other hand, it is less trappy: a simple implementation
that just overrides close will not force bytes to be
written one-at-a-time.
| Modifier and Type | Field and Description |
|---|---|
protected OutputStream |
delegate
The underlying
OutputStream instance. |
| Constructor and Description |
|---|
FilterOutputStream2(OutputStream delegate)
Construct a
FilterOutputStream2 based on
the specified base stream. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected final OutputStream delegate
OutputStream instance.public FilterOutputStream2(OutputStream delegate)
FilterOutputStream2 based on
the specified base stream.
Note that base stream is closed if this stream is closed.
delegate - specified base stream.public void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.