Package org.apache.lucene.tests.mockfile
Class FilterOutputStream2
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.lucene.tests.mockfile.FilterOutputStream2
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public abstract class FilterOutputStream2 extends OutputStream
AFilterOutputStream2
contains anotherOutputStream
, 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 transformwrite
calls, you need to override multiple methods. On the other hand, it is less trappy: a simple implementation that just overridesclose
will not force bytes to be written one-at-a-time.
-
-
Field Summary
Fields Modifier and Type Field Description protected OutputStream
delegate
The underlyingOutputStream
instance.
-
Constructor Summary
Constructors Constructor Description FilterOutputStream2(OutputStream delegate)
Construct aFilterOutputStream2
based on the specified base stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
delegate
protected final OutputStream delegate
The underlyingOutputStream
instance.
-
-
Constructor Detail
-
FilterOutputStream2
public FilterOutputStream2(OutputStream delegate)
Construct aFilterOutputStream2
based on the specified base stream.Note that base stream is closed if this stream is closed.
- Parameters:
delegate
- specified base stream.
-
-
Method Detail
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
-