Package com.storedobject.common
Class TeeOutputStream
java.lang.Object
java.io.OutputStream
com.storedobject.common.TeeOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An output stream that simultaneously writes output to 2 different output streams. This may be
used for debugging content of output streams.
- Author:
- Syam
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with no output streams provided.TeeOutputStream(OutputStream first, OutputStream second) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()Get the first stream.Get the second stream.voidsetFirstStream(OutputStream first) Set the first stream.voidsetSecondStream(OutputStream second) Set the second stream.voidwrite(byte[] b) voidwrite(byte[] b, int offset, int length) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
TeeOutputStream
public TeeOutputStream()Constructor with no output streams provided. -
TeeOutputStream
Constructor.- Parameters:
first- First streamsecond- Second stream
-
-
Method Details
-
setFirstStream
Set the first stream.- Parameters:
first- First stream
-
getFirstStream
-
setSecondStream
Set the second stream.- Parameters:
second- Second stream
-
getSecondStream
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-