Package org.apache.tools.ant.util

# Class TeeOutputStream

java.lang.Object
java.io.OutputStream
org.apache.tools.ant.util.TeeOutputStream

All Implemented Interfaces:
  `Closeable`, `Flushable`, `AutoCloseable`

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TeeOutputStream(OutputStream left, OutputStream right)`
  Constructor for TeeOutputStream.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close both output streams.
  `void`
  `flush()`
  Flush both output streams.
  `void`
  `write(byte[] b)`
  Write a byte array to both output streams.
  `void`
  `write(byte[] b, int off, int len)`
  Write a byte array to both output streams.
  `void`
  `write(int b)`
  Write a byte to both output streams.

  ### Methods inherited from class java.io.OutputStream

  `nullOutputStream`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TeeOutputStream

    public TeeOutputStream(OutputStream left, OutputStream right)
    Constructor for TeeOutputStream.
    Parameters:
      `left` - one of the output streams.
      `right` - the other output stream.

- ## Method Details

  - ### close

    public void close() throws IOException
    Close both output streams.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Overrides:
      `close` in class `OutputStream`
    Throws:
      `IOException` - on error.

  - ### flush

    public void flush() throws IOException
    Flush both output streams.
    Specified by:
      `flush` in interface `Flushable`
    Overrides:
      `flush` in class `OutputStream`
    Throws:
      `IOException` - on error

  - ### write

    public void write(byte[] b) throws IOException
    Write a byte array to both output streams.
    Overrides:
      `write` in class `OutputStream`
    Parameters:
      `b` - an array of bytes.
    Throws:
      `IOException` - on error.

  - ### write

    public void write(byte[] b, int off, int len) throws IOException
    Write a byte array to both output streams.
    Overrides:
      `write` in class `OutputStream`
    Parameters:
      `b` - the data.
      `off` - the start offset in the data.
      `len` - the number of bytes to write.
    Throws:
      `IOException` - on error.

  - ### write

    public void write(int b) throws IOException
    Write a byte to both output streams.
    Specified by:
      `write` in class `OutputStream`
    Parameters:
      `b` - the byte to write.
    Throws:
      `IOException` - on error.