Package cx.ath.matthew.io

# Class TeeOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
cx.ath.matthew.io.TeeOutputStream

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

public class TeeOutputStream extends FilterOutputStream
Class to copy a stream to another stream or file as it is being sent through a stream pipe E.g.

        PrintWriter r = new PrintWriter(new TeeOutputStream(new FileOutputStream("file"), new File("otherfile")));

## Constructor Summary

Constructors
Constructor
Description
`TeeOutputStream(OutputStream os, File f)`
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.
`TeeOutputStream(OutputStream os, File f, boolean append)`
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.
`TeeOutputStream(OutputStream os, OutputStream tos)`
Create a new TeeOutputStream on the given OutputStream and copy the stream to the other OuputStream.
`TeeOutputStream(OutputStream os, String f)`
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.
`TeeOutputStream(OutputStream os, String f, boolean append)`
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`finalize()`
`void`
`flush()`
`void`
`write(byte[] b)`
`void`
`write(byte[] b, int off, int len)`
`void`
`write(int b)`

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

`nullOutputStream`

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

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

## Constructor Details

### TeeOutputStream

public TeeOutputStream(OutputStream os, OutputStream tos) throws IOException
Create a new TeeOutputStream on the given OutputStream and copy the stream to the other OuputStream.

Parameters:
  `os` - Writes to this OutputStream
  `tos` - Write to this OutputStream
Throws:
  `IOException`

### TeeOutputStream

public TeeOutputStream(OutputStream os, File f, boolean append) throws IOException
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.

Parameters:
  `os` - Writes to this OutputStream
  `f` - Write to this File
  `append` - Append to file not overwrite
Throws:
  `IOException`

### TeeOutputStream

public TeeOutputStream(OutputStream os, File f) throws IOException
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.

Parameters:
  `os` - Writes to this OutputStream
  `f` - Write to this File
Throws:
  `IOException`

### TeeOutputStream

public TeeOutputStream(OutputStream os, String f, boolean append) throws IOException
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.

Parameters:
  `os` - Writes to this OutputStream
  `f` - Write to this File
  `append` - Append to file not overwrite
Throws:
  `IOException`

### TeeOutputStream

public TeeOutputStream(OutputStream os, String f) throws IOException
Create a new TeeOutputStream on the given OutputStream and copy the stream to the given File.

Parameters:
  `os` - Writes to this OutputStream
  `f` - Write to this File
Throws:
  `IOException`

## Method Details

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `FilterOutputStream`
Throws:
  `IOException`

### flush

public void flush() throws IOException

Specified by:
  `flush` in interface `Flushable`
Overrides:
  `flush` in class `FilterOutputStream`
Throws:
  `IOException`

### write

public void write(int b) throws IOException

Overrides:
  `write` in class `FilterOutputStream`
Throws:
  `IOException`

### write

public void write(byte[] b) throws IOException

Overrides:
  `write` in class `FilterOutputStream`
Throws:
  `IOException`

### write

public void write(byte[] b, int off, int len) throws IOException

Overrides:
  `write` in class `FilterOutputStream`
Throws:
  `IOException`

### finalize

public void finalize()

Overrides:
  `finalize` in class `Object`