Package cx.ath.matthew.io

# Class TeeInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
cx.ath.matthew.io.TeeInputStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

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

        Reader r = new InputStreamReader(new TeeInputStream(new FileInputStream("file"), new File("otherfile")));

## Constructor Summary

Constructors
Constructor
Description
`TeeInputStream(InputStream is, File f)`
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.
`TeeInputStream(InputStream is, File f, boolean append)`
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.
`TeeInputStream(InputStream is, OutputStream tos)`
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.
`TeeInputStream(InputStream is, String f)`
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.
`TeeInputStream(InputStream is, String f, boolean append)`
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.

## Method Summary

Modifier and Type
Method
Description
`int`
`available()`
`void`
`close()`
`void`
`finalize()`
`void`
`flush()`
`void`
`mark(int readlimit)`
`boolean`
`markSupported()`
`int`
`read()`
`int`
`read(byte[] b)`
`int`
`read(byte[] b, int off, int len)`
`void`
`reset()`
`long`
`skip(long n)`

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

`nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo`

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

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

## Constructor Details

### TeeInputStream

public TeeInputStream(InputStream is, OutputStream tos) throws IOException
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.

Parameters:
  `is` - Reads from this InputStream
  `tos` - Write to this OutputStream
Throws:
  `IOException`

### TeeInputStream

public TeeInputStream(InputStream is, File f, boolean append) throws IOException
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.

Parameters:
  `is` - Reads from this InputStream
  `f` - Write to this File
  `append` - Append to file not overwrite
Throws:
  `IOException`

### TeeInputStream

public TeeInputStream(InputStream is, File f) throws IOException
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.

Parameters:
  `is` - Reads from this InputStream
  `f` - Write to this File
Throws:
  `IOException`

### TeeInputStream

public TeeInputStream(InputStream is, String f, boolean append) throws IOException
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.

Parameters:
  `is` - Reads from this InputStream
  `f` - Write to this File
  `append` - Append to file not overwrite
Throws:
  `IOException`

### TeeInputStream

public TeeInputStream(InputStream is, String f) throws IOException
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.

Parameters:
  `is` - Reads from this InputStream
  `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 `FilterInputStream`
Throws:
  `IOException`

### flush

public void flush() throws IOException

Throws:
  `IOException`

### available

public int available() throws IOException

Overrides:
  `available` in class `FilterInputStream`
Throws:
  `IOException`

### read

public int read() throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### read

public int read(byte[] b) throws IOException

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### read

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

Overrides:
  `read` in class `FilterInputStream`
Throws:
  `IOException`

### skip

public long skip(long n) throws IOException

Overrides:
  `skip` in class `FilterInputStream`
Throws:
  `IOException`

### mark

public void mark(int readlimit)

Overrides:
  `mark` in class `FilterInputStream`

### markSupported

public boolean markSupported()

Overrides:
  `markSupported` in class `FilterInputStream`

### reset

public void reset() throws IOException

Overrides:
  `reset` in class `FilterInputStream`
Throws:
  `IOException`

### finalize

public void finalize()

Overrides:
  `finalize` in class `Object`