net.sf.basedb.util
Class InputStreamCombiner
java.lang.Object
java.io.InputStream
net.sf.basedb.util.InputStreamCombiner
- All Implemented Interfaces:
- Closeable
public class InputStreamCombiner
- extends InputStream
An input stream implementation that reads one or more input streams
sequentially. When the end of the first stream has been reached, reading
continues on the next one, and so on until all streams have been read.
The underlying streams are automatically closed once they have been fully
read.
- Since:
- 2.16
- Author:
- Nicklas
- Last modified
- $Date: 2010-05-27 10:54:05 +0200 (Thu, 27 May 2010) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
in
private final InputStream[] in
index
private int index
InputStreamCombiner
public InputStreamCombiner(InputStream... in)
- Create a new stream combiner using the given streams to read from
- Parameters:
in
- The stream to read from, must be an array with at least
one stream
available
public int available()
throws IOException
- Overrides:
available
in class InputStream
- Throws:
IOException
close
public void close()
throws IOException
- Closes all underlying streams.
- Specified by:
close
in interface Closeable
- Overrides:
close
in class InputStream
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Overrides:
read
in class InputStream
- Throws:
IOException
read
public int read(byte[] b)
throws IOException
- Overrides:
read
in class InputStream
- Throws:
IOException
skip
public long skip(long n)
throws IOException
- Overrides:
skip
in class InputStream
- Throws:
IOException
read
public int read()
throws IOException
- Specified by:
read
in class InputStream
- Throws:
IOException
nextStream
private void nextStream()