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 TypeMethodDescriptionvoid
close()
void
flush()
Get the first stream.Get the second stream.void
setFirstStream
(OutputStream first) Set the first stream.void
setSecondStream
(OutputStream second) Set the second stream.void
write
(byte[] b) void
write
(byte[] b, int offset, int length) void
write
(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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-