Java PipedInputStream.receive(int b)
Syntax
PipedInputStream.receive(int b) has the following syntax.
protected void receive(int b) throws IOException
Example
In the following code shows how to use PipedInputStream.receive(int b) method.
// w ww .j a v 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();
// connect input and output
in.connect(out);
// write something
out.write(70);
out.write(71);
// receive a byte
in.receive(71);
in.close();
}
}
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »