Package net.sf.basedb.util
Class InputStreamCombiner
- java.lang.Object
-
- java.io.InputStream
-
- net.sf.basedb.util.InputStreamCombiner
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
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 (to, 27 maj 2010) $
-
-
Field Summary
Fields Modifier and Type Field Description private InputStream[]
in
private int
index
-
Constructor Summary
Constructors Constructor Description InputStreamCombiner(InputStream... in)
Create a new stream combiner using the given streams to read from
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
Closes all underlying streams.private void
nextStream()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
long
skip(long n)
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
-
-
-
Field Detail
-
in
private final InputStream[] in
-
index
private int index
-
-
Constructor Detail
-
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
-
-
Method Detail
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
Closes all underlying streams.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
nextStream
private void nextStream()
-
-