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:
 java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class TeeOutputStream extends ProxyOutputStream
Classic splitter ofOutputStream. Named after the UNIX 'tee' command. It allows a stream to be branched off so there are now two streams. 
- 
- 
Constructor Summary
Constructors Constructor Description TeeOutputStream(java.io.OutputStream out, java.io.OutputStream branch)Constructs a TeeOutputStream. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes both output streams.voidflush()Flushes both streams.voidwrite(byte[] b)Writes the bytes to both streams.voidwrite(byte[] b, int off, int len)Writes the specified bytes to both streams.voidwrite(int b)Writes a byte to both streams. 
 - 
 
- 
- 
Method Detail
- 
close
public void close() throws java.io.IOExceptionCloses 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 interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Overrides:
 closein classProxyOutputStream- Throws:
 java.io.IOException- if an I/O error occurs.
 
- 
flush
public void flush() throws java.io.IOExceptionFlushes both streams.- Specified by:
 flushin interfacejava.io.Flushable- Overrides:
 flushin classProxyOutputStream- Throws:
 java.io.IOException- if an I/O error occurs.
 
- 
write
public void write(byte[] b) throws java.io.IOExceptionWrites the bytes to both streams.- Overrides:
 writein classProxyOutputStream- Parameters:
 b- the bytes to write- Throws:
 java.io.IOException- if an I/O error occurs.
 
- 
write
public void write(byte[] b, int off, int len) throws java.io.IOExceptionWrites the specified bytes to both streams.- Overrides:
 writein classProxyOutputStream- Parameters:
 b- the bytes to writeoff- The start offsetlen- The number of bytes to write- Throws:
 java.io.IOException- if an I/O error occurs.
 
- 
write
public void write(int b) throws java.io.IOExceptionWrites a byte to both streams.- Overrides:
 writein classProxyOutputStream- Parameters:
 b- the byte to write- Throws:
 java.io.IOException- if an I/O error occurs.
 
 - 
 
 -