You can use SequenceInputStream.
A SequenceInputStream represents the logical concatenation of other input streams. It starts out with an ordered collection of input streams and reads from the first one until end of file is reached, whereupon it reads from the second one, and so on, until end of file is reached on the last of the contained input streams
Here is an example and one more
sample code directly form above link:
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.SequenceInputStream;
import java.util.Enumeration;
import java.util.Vector;
public class SequenceInputStreamTest {
public static void main(String[] args) throws Exception {
FileInputStream fis1 = new FileInputStream("testfile1.txt");
FileInputStream fis2 = new FileInputStream("testfile2.txt");
FileInputStream fis3 = new FileInputStream("testfile3.txt");
Vector<InputStream> inputStreams = new Vector<InputStream>();
inputStreams.add(fis1);
inputStreams.add(fis2);
inputStreams.add(fis3);
Enumeration<InputStream> enu = inputStreams.elements();
SequenceInputStream sis = new SequenceInputStream(enu);
int oneByte;
while ((oneByte = sis.read()) != -1) {
System.out.write(oneByte);
}
System.out.flush();
}
}