Java ByteArrayInputStream(byte[] buf)建構函式範例

2019-10-16 22:17:04

Java ByteArrayInputStream(byte[] buf)建構函式範例

ByteArrayInputStreamByteArrayInputStream(byte [] buf)建構函式的語法如下。

public ByteArrayInputStream(byte[] buf)

範例

在下面的程式碼中展示了如何使用ByteArrayInputStream.ByteArrayInputStream(byte [] buf)建構函式。

import java.io.ByteArrayInputStream;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
  // At: WWw。y Ii b Ai .C O M 
    byte[] buf = { 65, 66, 67, 68, 69 };

    // create new byte array input stream
    ByteArrayInputStream bais = new ByteArrayInputStream(buf);


  }
}