Class ClassicMp4ContainerSource.TeeInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.mp4parser.streaming.input.mp4.ClassicMp4ContainerSource.TeeInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- ClassicMp4ContainerSource
public static class ClassicMp4ContainerSource.TeeInputStream extends FilterInputStream
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description TeeInputStream(InputStream input, OutputStream branch)Creates a TeeInputStream that proxies the givenInputStreamand copies all read bytes to the givenOutputStream.
-
Method Summary
Modifier and Type Method Description intread()Reads a single byte from the proxied input stream and writes it to the associated output stream.intread(byte[] bts)Reads bytes from the proxied input stream and writes the read bytes to the associated output stream.intread(byte[] bts, int st, int end)Reads bytes from the proxied input stream and writes the read bytes to the associated output stream.-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
-
-
-
Constructor Detail
-
TeeInputStream
public TeeInputStream(InputStream input, OutputStream branch)
Creates a TeeInputStream that proxies the givenInputStreamand copies all read bytes to the givenOutputStream. The given output stream will not be closed when this stream gets closed.- Parameters:
input- input stream to be proxiedbranch- output stream that will receive a copy of all bytes read
-
-
Method Detail
-
read
public int read() throws IOExceptionReads a single byte from the proxied input stream and writes it to the associated output stream.- Overrides:
readin classFilterInputStream- Returns:
- next byte from the stream, or -1 if the stream has ended
- Throws:
IOException- if the stream could not be read (or written)
-
read
public int read(byte[] bts, int st, int end) throws IOExceptionReads bytes from the proxied input stream and writes the read bytes to the associated output stream.- Overrides:
readin classFilterInputStream- Parameters:
bts- byte bufferst- start offset within the bufferend- maximum number of bytes to read- Returns:
- number of bytes read, or -1 if the stream has ended
- Throws:
IOException- if the stream could not be read (or written)
-
read
public int read(byte[] bts) throws IOExceptionReads bytes from the proxied input stream and writes the read bytes to the associated output stream.- Overrides:
readin classFilterInputStream- Parameters:
bts- byte buffer- Returns:
- number of bytes read, or -1 if the stream has ended
- Throws:
IOException- if the stream could not be read (or written)
-
-