public class TeeInputStream
extends java.io.InputStream
TemporaryBuffer, where any data read or skipped
by the caller is also duplicated into the temporary buffer. Later the
temporary buffer can then be used instead of the original source stream.
During close this stream copies any remaining data from the source stream
into the destination stream.| Modifier and Type | Field and Description |
|---|---|
private java.io.OutputStream |
dst |
private byte[] |
skipBuffer |
private java.io.InputStream |
src |
| Constructor and Description |
|---|
TeeInputStream(java.io.InputStream src,
java.io.OutputStream dst)
Initialize a tee input stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
long |
skip(long count) |
private byte[] |
skipBuffer() |
private byte[] skipBuffer
private java.io.InputStream src
private java.io.OutputStream dst
public TeeInputStream(java.io.InputStream src,
java.io.OutputStream dst)
src - source stream to consume.dst - destination to copy the source to as it is consumed. Typically
this is a TemporaryBuffer.public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long count)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionprivate byte[] skipBuffer()