public class JoinedInputStream
extends java.io.InputStream
InputStream's into one.
Reading from an instance of JoinedInputStream will
read each underlying InputStream until it is
depleted and then continue with the next one.
Depleted InputStream's will be closed as soon
as possible.
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.io.InputStream> |
streams |
| Constructor and Description |
|---|
JoinedInputStream() |
| Modifier and Type | Method and Description |
|---|---|
JoinedInputStream |
add(java.io.InputStream in)
Add another
InputStream. |
void |
close() |
private void |
popStream()
Remove the current
InputStream and close it. |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
public JoinedInputStream add(java.io.InputStream in)
InputStream.
It is allowed to add more InputStream's
even after reading has started.
It is illegal to add more streams after the joined stream has been closed.
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionprivate void popStream()
throws java.io.IOException
InputStream and close it.java.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.IOException