Package org.eclipse.jgit.util.io
Class TeeInputStream
java.lang.Object
java.io.InputStream
org.eclipse.jgit.util.io.TeeInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Input stream that copies data read to another output stream.
This stream is primarily useful with a
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.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTeeInputStream
(InputStream src, OutputStream dst) Initialize a tee input stream. -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset
-
Field Details
-
skipBuffer
private byte[] skipBuffer -
src
-
dst
-
-
Constructor Details
-
TeeInputStream
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 Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
skipBuffer
private byte[] skipBuffer()
-