Package org.zeroturnaround.exec.stream
Class TeeOutputStream
java.lang.Object
java.io.OutputStream
org.zeroturnaround.exec.stream.TeeOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Splits an OutputStream into two. Named after the unix 'tee'
command. It allows a stream to be branched off so there
are now two streams.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes both output streamsvoid
flush()
Flush both output streams.void
write
(byte[] b) Write a byte array to both output streams.void
write
(byte[] b, int off, int len) Write a byte array to both output streams.void
write
(int b) Write a byte to both output streams.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
left
-
right
-
-
Constructor Details
-
TeeOutputStream
-
-
Method Details
-
write
Write a byte array to both output streams.- Overrides:
write
in classOutputStream
- Parameters:
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.- Throws:
IOException
- on error.
-
write
Write a byte to both output streams.- Specified by:
write
in classOutputStream
- Parameters:
b
- the byte to write.- Throws:
IOException
- on error.
-
write
Write a byte array to both output streams.- Overrides:
write
in classOutputStream
- Parameters:
b
- an array of bytes.- Throws:
IOException
- on error.
-
close
Closes both output streams- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
- on error.
-
flush
Flush both output streams.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- on error
-