Java.io.PipedInputStream.read Byte() 方法 Java.io.PipedInputStream.read() 方法 Java.io.PipedInputStream.receive() 方法 Java.io.PipedInputStream.read Byte() 方法 package com.codingdict; import java.io.*; public class PipedInputStreamDemo { public static void main(String[] args) { // create a new Piped input and Output Stream PipedOutputStream out = new PipedOutputStream(); PipedInputStream in = new PipedInputStream(); try { // connect input and output in.connect(out); // write something out.write(70); out.write(71); // read what we wrote into an array of bytes byte[] b = new byte[2]; in.read(b, 0, 2); // print the array as a string String s = new String(b); System.out.println("" + s); } catch (IOException ex) { ex.printStackTrace(); } } } Java.io.PipedInputStream.read() 方法 Java.io.PipedInputStream.receive() 方法