FileDocCategorySizeDatePackage
TeeOutputStream.javaAPI DocAndroid 1.5 API2964Wed May 06 22:42:46 BST 2009org.apache.commons.io.output

TeeOutputStream

public class TeeOutputStream extends ProxyOutputStream
Classic splitter of OutputStream. Named after the unix 'tee' command. It allows a stream to be branched off so there are now two streams.
version
$Id: TeeOutputStream.java 610010 2008-01-08 14:50:59Z niallp $

Fields Summary
protected OutputStream
branch
the second OutputStream to write to
Constructors Summary
public TeeOutputStream(OutputStream out, OutputStream branch)
Constructs a TeeOutputStream.

param
out the main OutputStream
param
branch the second OutputStream

        super(out);
        this.branch = branch;
    
Methods Summary
public voidclose()
Closes both streams.

throws
IOException if an I/O error occurs

        super.close();
        this.branch.close();
    
public voidflush()
Flushes both streams.

throws
IOException if an I/O error occurs

        super.flush();
        this.branch.flush();
    
public synchronized voidwrite(byte[] b)
Write the bytes to both streams.

param
b the bytes to write
throws
IOException if an I/O error occurs

        super.write(b);
        this.branch.write(b);
    
public synchronized voidwrite(byte[] b, int off, int len)
Write the specified bytes to both streams.

param
b the bytes to write
param
off The start offset
param
len The number of bytes to write
throws
IOException if an I/O error occurs

        super.write(b, off, len);
        this.branch.write(b, off, len);
    
public synchronized voidwrite(int b)
Write a byte to both streams.

param
b the byte to write
throws
IOException if an I/O error occurs

        super.write(b);
        this.branch.write(b);