Package org.apache.commons.io.output
Class TeeOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.commons.io.output.ProxyOutputStream
org.apache.commons.io.output.TeeOutputStream
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable
Classic splitter of 
OutputStream. Named after the Unix 'tee' command. It allows a stream to be branched off
 so there are now two streams.- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.commons.io.output.ProxyOutputStreamProxyOutputStream.Builder
- 
Field SummaryFieldsFields inherited from class java.io.FilterOutputStreamout
- 
Constructor SummaryConstructorsConstructorDescriptionTeeOutputStream(OutputStream out, OutputStream branch) Constructs a TeeOutputStream.
- 
Method SummaryMethods inherited from class org.apache.commons.io.output.ProxyOutputStreamafterWrite, beforeWrite, handleIOException, setReference
- 
Field Details- 
branchThe second OutputStream to write to. TODO Make private and final in 3.0.
 
- 
- 
Constructor Details- 
TeeOutputStreamConstructs a TeeOutputStream.- Parameters:
- out- the main OutputStream
- branch- the second OutputStream
 
 
- 
- 
Method Details- 
closeCloses both output streams.If closing the main output stream throws an exception, attempt to close the branch output stream. If closing the main and branch output streams both throw exceptions, which exceptions is thrown by this method is currently unspecified and subject to change. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- ProxyOutputStream
- Throws:
- IOException- if an I/O error occurs.
 
- 
flushFlushes both streams.- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- ProxyOutputStream
- Throws:
- IOException- if an I/O error occurs.
 
- 
writeWrites the bytes to both streams.- Overrides:
- writein class- ProxyOutputStream
- Parameters:
- b- the bytes to write
- Throws:
- IOException- if an I/O error occurs.
 
- 
writeWrites the specified bytes to both streams.- Overrides:
- writein class- ProxyOutputStream
- Parameters:
- b- the bytes to write
- off- The start offset
- len- The number of bytes to write
- Throws:
- IOException- if an I/O error occurs.
 
- 
writeWrites a byte to both streams.- Overrides:
- writein class- ProxyOutputStream
- Parameters:
- b- the byte to write
- Throws:
- IOException- if an I/O error occurs.
 
 
-