Package de.pdark.decentxml
Class JoinedInputStream
java.lang.Object
java.io.InputStream
de.pdark.decentxml.JoinedInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class allows to join several
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(InputStream in) Add anotherInputStream.voidclose()private voidRemove the currentInputStreamand close it.intread()intread(byte[] b, int off, int len) Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
-
Field Details
-
streams
-
-
Constructor Details
-
JoinedInputStream
public JoinedInputStream()
-
-
Method Details
-
add
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
- Specified by:
readin classInputStream- Throws:
IOException
-
popStream
Remove the currentInputStreamand close it.- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-