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 voidclose()voidflush()static OutputStreammergeStreams(@Nullable OutputStream stream1, @Nullable OutputStream stream2)Create an output stream that forwards to all given output streams, ignoring null parameters.voidwrite(byte[] pB)voidwrite(byte[] pB, int pOff, int pLen)voidwrite(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:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] pB) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] pB, int pOff, int pLen) 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
-
-