Package de.pdark.decentxml
Class JoinedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- de.pdark.decentxml.JoinedInputStream
-
- All Implemented Interfaces:
Closeable
public class JoinedInputStream extends InputStream
This class allows to join severalInputStream
's into one.Reading from an instance of
JoinedInputStream
will read each underlyingInputStream
until it is depleted and then continue with the next one.Depleted
InputStream
's will be closed as soon as possible.- Author:
- digulla
-
-
Constructor Summary
Constructors Constructor Description JoinedInputStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JoinedInputStream
add(InputStream in)
Add anotherInputStream
.void
close()
int
read()
int
read(byte[] b, int off, int len)
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
-
-
-
-
Method Detail
-
add
public JoinedInputStream add(InputStream in)
Add anotherInputStream
.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.
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
-