org.apache.commons.io.output

Class 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 155419 2005-02-26 13:02:41Z dirkv $
Author:
Henri Yandell

Field Summary

protected OutputStream
branch
the second OutputStream to write to

Constructor Summary

TeeOutputStream(OutputStream out, OutputStream branch)
Constructs a TeeOutputStream.

Method Summary

void
close()
Closes both streams.
void
flush()
Flushes both streams.
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)

Methods inherited from class org.apache.commons.io.output.ProxyOutputStream

close, flush, write, write, write

Field Details

branch

protected OutputStream branch
the second OutputStream to write to

Constructor Details

TeeOutputStream

public TeeOutputStream(OutputStream out,
                       OutputStream branch)
Constructs a TeeOutputStream.
Parameters:
out - the main OutputStream
branch - the second OutputStream

Method Details

close

public void close()
            throws IOException
Closes both streams.
Overrides:
close in interface ProxyOutputStream
See Also:
java.io.OutputStream.close()

flush

public void flush()
            throws IOException
Flushes both streams.
Overrides:
flush in interface ProxyOutputStream
See Also:
java.io.OutputStream.flush()

write

public void write(byte[] b)
            throws IOException
Overrides:
write in interface ProxyOutputStream
See Also:
java.io.OutputStream.write(byte[])

write

public void write(byte[] b,
                  int off,
                  int len)
            throws IOException
Overrides:
write in interface ProxyOutputStream
See Also:
java.io.OutputStream.write(byte[], int, int)

write

public void write(int b)
            throws IOException
Overrides:
write in interface ProxyOutputStream
See Also:
java.io.OutputStream.write(int)