Java tutorial
import java.io.PipedInputStream; import java.io.PipedOutputStream; public class Main extends PipedInputStream { public static void main(String[] args) throws Exception { PipedOutputStream out = new PipedOutputStream(); Main in = new Main(); // connect input and output out.connect(in); // write something out.write(70); out.write(71); // print what we wrote for (int i = 0; i < 2; i++) { System.out.println("" + (char) in.read()); } out.close(); } }