public class TeeInputStream extends InputStream
InputStream that writes all bytes read to a
specified OutputStream.| Constructor and Description |
|---|
TeeInputStream(InputStream base,
OutputStream tee) |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns the number of bytes available from the base stream.
|
void |
close()
Closes the base stream, but not the tee.
|
void |
mark(int readlimit)
Sets a mark on the base stream.
|
boolean |
markSupported()
Returns whether the base stream supports
mark(int). |
int |
read()
Reads a single byte from the base, writing it to the tee.
|
int |
read(byte[] b)
Reads as many bytes as possible from the base, up to the size of
the passed buffer, and writes them to the tee.
|
int |
read(byte[] b,
int off,
int len)
Reads multiple bytes from the base, into an arbitrary position
in the specified buffer, and writes the same bytes to the tee.
|
void |
reset()
Resets the base stream to a preset mark.
|
long |
skip(long n)
Skips a specified number of bytes in the input stream.
|
public TeeInputStream(InputStream base, OutputStream tee)
public int available()
throws IOException
available in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class InputStreamIOExceptionpublic boolean markSupported()
mark(int). Has no
effect on the tee.markSupported in class InputStreampublic void mark(int readlimit)
mark in class InputStreampublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOException