- java.lang.Object
-
- java.io.InputStream
-
- org.eclipse.jgit.util.io.TeeInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class TeeInputStream extends InputStream
Input stream that copies data read to another output stream. This stream is primarily useful with aTemporaryBuffer, 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.
-
-
Constructor Summary
Constructors Constructor Description TeeInputStream(InputStream src, OutputStream dst)Initialize a tee input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intread()intread(byte[] b, int off, int len)longskip(long count)-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
-
-
-
Constructor Detail
-
TeeInputStream
public TeeInputStream(InputStream src, OutputStream dst)
Initialize a tee input stream.- Parameters:
src- source stream to consume.dst- destination to copy the source to as it is consumed. Typically this is aTemporaryBuffer.
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
skip
public long skip(long count) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-