FileDocCategorySizeDatePackage
TeeOutputStream.javaAPI DocApache Ant 1.702671Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.util

TeeOutputStream

public class TeeOutputStream extends OutputStream
A simple T-piece to replicate an output stream into two separate streams

Fields Summary
private OutputStream
left
private OutputStream
right
Constructors Summary
public TeeOutputStream(OutputStream left, OutputStream right)
Constructor for TeeOutputStream.

param
left one of the output streams.
param
right the other output stream.

        this.left = left;
        this.right = right;
    
Methods Summary
public voidclose()
Close both output streams.

throws
IOException on error.

        try {
            left.close();
        } finally {
            right.close();
        }
    
public voidflush()
Flush both output streams.

throws
IOException on error

        left.flush();
        right.flush();
    
public voidwrite(byte[] b)
Write a byte array to both output streams.

param
b an array of bytes.
throws
IOException on error.

        left.write(b);
        right.write(b);
    
public voidwrite(byte[] b, int off, int len)
Write a byte array to both output streams.

param
b the data.
param
off the start offset in the data.
param
len the number of bytes to write.
throws
IOException on error.

        left.write(b, off, len);
        right.write(b, off, len);
    
public voidwrite(int b)
Write a byte to both output streams.

param
b the byte to write.
throws
IOException on error.

        left.write(b);
        right.write(b);