Concatenation Streams
Concatenation Streams allow multiple input sources to be combined into a singe source stream.
ConcatInputStream
Combines multiple byte stream sources into a single byte stream.
Example
// Pre-pend data to a InputStream "in"
// giving a new stream.
in = new ConcatInputStream(
new ByteArrayInputStream(
new byte[]{
3,1,4,1,5,9
}
),
in
);
ConcatReader
Combines multiple character stream sources into a single character stream.
Example
// Pre-pend data to a Reader "in"
// giving a new reader.
in = new ConcatReader(
new StringReader(
"Pre-pending this data."
),
in
);