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 OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.