Java PipedOutputStream.write(int b)
Syntax
PipedOutputStream.write(int b) has the following syntax.
public void write(int b) throws IOException
Example
In the following code shows how to use PipedOutputStream.write(int b) method.
/*from w w w . j av a 2 s . c o m*/
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();
out.connect(in);
out.write(70);
out.write(71);
out.write(72);
out.flush();
for (int i = 0; i < 3; i++) {
System.out.println((char) in.read());
}
out.close();
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »