public class UnionInputStream extends InputStream
This stream may enter into an EOF state, returning -1 from any of the read methods, and then later successfully read additional bytes if a new InputStream is added after reaching EOF.
Currently this stream does not support the mark/reset APIs. If mark and later
reset functionality is needed the caller should wrap this stream with a
BufferedInputStream
.
Constructor and Description |
---|
UnionInputStream()
Create an empty InputStream that is currently at EOF state.
|
UnionInputStream(InputStream... inputStreams)
Create an InputStream that is a union of the individual streams.
|
Modifier and Type | Method and Description |
---|---|
void |
add(InputStream in)
Add the given InputStream onto the end of the stream queue.
|
int |
available() |
void |
close() |
boolean |
isEmpty()
Returns true if there are no more InputStreams in the stream queue.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
long |
skip(long count) |
mark, markSupported, read, reset
public UnionInputStream()
public UnionInputStream(InputStream... inputStreams)
As each stream reaches EOF, it will be automatically closed before bytes from the next stream are read.
inputStreams
- streams to be pushed onto this stream.public void add(InputStream in)
When the stream reaches EOF it will be automatically closed.
in
- the stream to add; must not be null.public boolean isEmpty()
If this method returns true
then all read methods will signal EOF
by returning -1, until another InputStream has been pushed into the queue
with add(InputStream)
.
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public long skip(long count) throws IOException
skip
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2016 Eclipse JGit Project. All rights reserved.