Java IO Tutorial - Java SequenceInputStream .read (byte[] b, int off, int len)








Syntax

SequenceInputStream.read(byte[] b, int off, int len) has the following syntax.

public int read(byte[] b, int off, int len)  throws IOException

Example

In the following code shows how to use SequenceInputStream.read(byte[] b, int off, int len) method.

//from   w  w  w  .j a  va2 s. co  m
import java.io.FileInputStream;
import java.io.IOException;
import java.io.SequenceInputStream;

public class Main {
  public static void main(String args[]) throws IOException {
    SequenceInputStream inStream;
    FileInputStream f1 = new FileInputStream("ByteArrayIOApp.java");
    FileInputStream f2 = new FileInputStream("FileIOApp.java");
    inStream = new SequenceInputStream(f1, f2);

    byte[] arrayBytes = new byte[100];
    int c = inStream.read(arrayBytes,10,10);

    inStream.close();
    f1.close();
    f2.close();
  }
}