Top Description Fields Constructors Methods
org.apache.commons.io.output

public Class TeeOutputStream

extends ProxyOutputStream
Class Inheritance
Imports
java.io.IOException, .OutputStream

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 471628 2006-11-06 04:06:45Z bayard $

Field Summary

Modifier and TypeField and Description
protected OutputStream
branch

the second OutputStream to write to

Constructor Summary

AccessConstructor and Description
public
TeeOutputStream(OutputStream
the main OutputStream
out
,
OutputStream
the second OutputStream
branch
)

Constructs a TeeOutputStream.

Method Summary

Modifier and TypeMethod and Description
public void
public void
public synchronized void
write(byte[]
the data to be written.
b
)

Overrides org.apache.commons.io.output.ProxyOutputStream.write.

Writes b.length bytes to this output stream.
public synchronized void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides org.apache.commons.io.output.ProxyOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.
public synchronized void
write(int
the byte.
b
)

Overrides org.apache.commons.io.output.ProxyOutputStream.write.

Writes the specified byte to this output stream.

Field Detail

branchback to summary
protected OutputStream branch

the second OutputStream to write to

Constructor Detail

TeeOutputStreamback to summary
public TeeOutputStream(OutputStream out, OutputStream branch)

Constructs a TeeOutputStream.

Parameters
out:OutputStream

the main OutputStream

branch:OutputStream

the second OutputStream

Method Detail

closeback to summary
public void close() throws IOException

Overrides org.apache.commons.io.output.ProxyOutputStream.close.

Implements java.io.Closeable.close.

Closes both streams.

Exceptions
IOException:

Doc from java.io.FilterOutputStream.close.

if an I/O error occurs.

See Also
java.io.OutputStream#close()
flushback to summary
public void flush() throws IOException

Overrides org.apache.commons.io.output.ProxyOutputStream.flush.

Implements java.io.Flushable.flush.

Flushes both streams.

Exceptions
IOException:

Doc from java.io.FilterOutputStream.flush.

if an I/O error occurs.

See Also
java.io.OutputStream#flush()
writeback to summary
public synchronized void write(byte[] b) throws IOException

Overrides org.apache.commons.io.output.ProxyOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes b.length bytes to this output stream.

Parameters
b:byte[]

the data to be written.

Exceptions
IOException:
if an I/O error occurs.
See Also
java.io.OutputStream#write(byte[])
writeback to summary
public synchronized void write(byte[] b, int off, int len) throws IOException

Overrides org.apache.commons.io.output.ProxyOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.

Exceptions
IOException:
if an I/O error occurs.
See Also
java.io.OutputStream#write(byte[], int, int)
writeback to summary
public synchronized void write(int b) throws IOException

Overrides org.apache.commons.io.output.ProxyOutputStream.write.

Doc from java.io.FilterOutputStream.write.

Writes the specified byte to this output stream.

The write method of FilterOutputStream calls the write method of its underlying output stream, that is, it performs out.write(b).

Implements the abstract write method of OutputStream.

Parameters
b:int

the byte.

Exceptions
IOException:
if an I/O error occurs.
See Also
java.io.OutputStream#write(int)