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 610010 2008-01-08 14:50:59Z niallp $

Field Summary
protected OutputStreambranch
the second OutputStream to write to
Constructor Summary
TeeOutputStream(OutputStream out, OutputStream branch)
Constructs a TeeOutputStream.
Method Summary
voidclose()
Closes both streams.
voidflush()
Flushes both streams.
voidwrite(byte[] b)
Write the bytes to both streams.
voidwrite(byte[] b, int off, int len)
Write the specified bytes to both streams.
voidwrite(int b)
Write a byte to both streams.

Field Detail

branch

protected OutputStream branch
the second OutputStream to write to

Constructor Detail

TeeOutputStream

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

Parameters: out the main OutputStream branch the second OutputStream

Method Detail

close

public void close()
Closes both streams.

Throws: IOException if an I/O error occurs

flush

public void flush()
Flushes both streams.

Throws: IOException if an I/O error occurs

write

public void write(byte[] b)
Write the bytes to both streams.

Parameters: b the bytes to write

Throws: IOException if an I/O error occurs

write

public void write(byte[] b, int off, int len)
Write the specified bytes to both streams.

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

write

public void write(int b)
Write a byte to both streams.

Parameters: b the byte to write

Throws: IOException if an I/O error occurs

Copyright (c) 2002-2011 Apache Software Foundation