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
AFilterOutputStream2contains anotherOutputStream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.Note: unlike
FilterOutputStreamthis class delegates every method by default. This means to transformwritecalls, you need to override multiple methods. On the other hand, it is less trappy: a simple implementation that just overridesclosewill not force bytes to be written one-at-a-time.
-
-
Field Summary
Fields Modifier and Type Field Description protected OutputStreamdelegateThe underlyingOutputStreaminstance.
-
Constructor Summary
Constructors Constructor Description FilterOutputStream2(OutputStream delegate)Construct aFilterOutputStream2based on the specified base stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
delegate
protected final OutputStream delegate
The underlyingOutputStreaminstance.
-
-
Constructor Detail
-
FilterOutputStream2
public FilterOutputStream2(OutputStream delegate)
Construct aFilterOutputStream2based 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:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
-