public abstract class FilterOutputStream2
extends java.io.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 java.io.OutputStream |
delegate
The underlying
OutputStream instance. |
Constructor and Description |
---|
FilterOutputStream2(java.io.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 java.io.OutputStream delegate
OutputStream
instance.public FilterOutputStream2(java.io.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 java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.