new ByteArrayInputStream(byte[] buf) : ByteArrayInputStream « java.io « Java by API






new ByteArrayInputStream(byte[] buf)

  
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {

    try {
      DataInputStream in3 = new DataInputStream(
        new ByteArrayInputStream("a dbcde".getBytes()));
      while(true)
        System.out.print((char)in3.readByte());
    } catch(EOFException e) {
      System.err.println("End of stream");
    }


  }
}

   
    
  








Related examples in the same category

1.new ByteArrayInputStream(byte[] buf, int offset, int length)
2.ByteArrayInputStream: available()
3.ByteArrayInputStream: read(byte[] b, int off, int len)
4.ByteArrayInputStream: reset()