MergedInputStream

public class MergedInputStream extends InputStream

MergedInputStream is an input stream which can merge two input streams into one. When the read() method is called, the first input stream will be read at first. However, if it has already reached the end, the second input stream will be read.

Author:Hugo Y. K. Lam

Constructors

MergedInputStream

public MergedInputStream(InputStream ins1, InputStream ins2)

Creates a new instance of MergedInputStream.

Parameters:
  • ins1 – the first input stream to be merged.
  • ins2 – the second input stream to be merged.

Methods

read

public int read()

Reads the first input stream and if it has reached the end, reads the second input stream. After this input stream has positioned to the second input stream, it will never come back to the first one.

See also: java.io.InputStream.read()