Java SequenceInputStream (InputStream s1, InputStream s2) Constructor
Syntax
SequenceInputStream(InputStream s1, InputStream s2) constructor from SequenceInputStream has the following syntax.
public SequenceInputStream(InputStream s1, InputStream s2)
Example
In the following code shows how to use SequenceInputStream.SequenceInputStream(InputStream s1, InputStream s2) constructor.
import java.io.FileInputStream;
import java.io.IOException;
import java.io.SequenceInputStream;
//from ww w. ja v a 2s. c om
public class Main {
public static void main(String args[]) throws IOException {
SequenceInputStream inStream;
FileInputStream f1 = new FileInputStream("file1.java");
FileInputStream f2 = new FileInputStream("file2.java");
inStream = new SequenceInputStream(f1, f2);
boolean eof = false;
int byteCount = 0;
while (!eof) {
int c = inStream.read();
if (c == -1)
eof = true;
else {
System.out.print((char) c);
++byteCount;
}
}
System.out.println(byteCount + " bytes were read");
inStream.close();
f1.close();
f2.close();
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »