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 InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public boolean markSupported()
mark(int)
. Has no
effect on the tee.markSupported
in class InputStream
public void mark(int readlimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException