Package com.saperion.common.io
Class ConcatenationInputStream
java.lang.Object
java.io.InputStream
com.saperion.common.io.ConcatenationInputStream
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable
Concatenates several
input streams to another input stream so that
if one reads the resulting stream it is the same as reading the streams one after another.
A ConcatenationInputStream is serializable if and only if all the streams
concatenated are serializable.- Author:
- jschwarz
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConcatenationInputStream(List<? extends InputStream> streams) Creates a new ConcatenationInputStream that concatenates the given streams -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static InputStreamcreate(InputStream... streams) Creates a new InputStream that concatenates the given streams.static InputStreamcreate(List<? extends InputStream> streams) Creates a new InputStream that concatenates the given streams.intread()intread(byte[] b, int off, int len) longskip(long n) Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Constructor Details
-
ConcatenationInputStream
Creates a new ConcatenationInputStream that concatenates the given streams- Parameters:
streams- the streams to concatenate
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
create
Creates a new InputStream that concatenates the given streams. If streams isnullor does not contain any elements anEmptyInputStreamis created. If streams contains one and only one element this element is returned. Otherwise a ConcatenationInputStream is returned.- Parameters:
streams- the streams to concatenate- Returns:
- a new InputStream that concatenates the given streams
-
create
Creates a new InputStream that concatenates the given streams. If streams isnullor does not contain any elements anEmptyInputStreamis created. If streams contains one and only one element this element is returned. Otherwise a ConcatenationInputStream is returned.- Parameters:
streams- the streams to concatenate- Returns:
- a new InputStream that concatenates the given streams
-