Package org.sosy_lab.common.io
Class DuplicateOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.sosy_lab.common.io.DuplicateOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class DuplicateOutputStream extends OutputStream
This class is an OutputStream implementation that sends everything to two other OutputStreams.Exceptions thrown by any of the streams will be relayed to the caller.
-
-
Constructor Summary
Constructors Constructor Description DuplicateOutputStream(OutputStream pStream1, OutputStream pStream2)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
static OutputStream
mergeStreams(@Nullable OutputStream stream1, @Nullable OutputStream stream2)
Create an output stream that forwards to all given output streams, ignoring null parameters.void
write(byte[] pB)
void
write(byte[] pB, int pOff, int pLen)
void
write(int pB)
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
DuplicateOutputStream
public DuplicateOutputStream(OutputStream pStream1, OutputStream pStream2)
-
-
Method Detail
-
mergeStreams
public static OutputStream mergeStreams(@Nullable OutputStream stream1, @Nullable OutputStream stream2)
Create an output stream that forwards to all given output streams, ignoring null parameters.
-
write
public void write(int pB) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] pB) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] pB, int pOff, int pLen) 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
-
-