public class MultiInputStream extends InputStream
MultiInputStream
concatenates multiple InputStream
s into
one. That might be useful for e.g. reading log files of multiple days.
The inputStreamIterator
needs to supply the InputStream
s to
concatenate one after the other. InputStream
s, which have been read,
are closed prior requesting the next.
Constructor and Description |
---|
MultiInputStream(Iterator<InputStream> inputStreamIterator)
Creates a new
MultiInputStream instance. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
read() |
int |
read(byte[] outputBuffer,
int offset,
int length) |
available, mark, markSupported, read, reset, skip
public MultiInputStream(Iterator<InputStream> inputStreamIterator)
MultiInputStream
instance.inputStreamIterator
- Iterator
, called whenever the next InputStream
needs to be
supplied. If it has no next element, the MultiInputStream
is closed.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(@Nullable byte[] outputBuffer, int offset, int length) throws IOException
read
in class InputStream
IOException
Copyright © 2025. All rights reserved.