List of usage examples for java.io PipedReader read
public synchronized int read() throws IOException
From source file:Main.java
public static void main(String[] args) { try {/*from w w w. j a va 2s . c o m*/ PipedWriter writer = new PipedWriter(); PipedReader reader = new PipedReader(writer); // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // check if reader is ready to read System.out.println(reader.ready()); // print the char array for (int i = 0; i < 2; i++) { System.out.println("" + (char) reader.read()); } reader.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { try {/* w w w. j ava2s .com*/ PipedWriter writer = new PipedWriter(); PipedReader reader = new PipedReader(writer, 100); // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // check if reader is ready to read System.out.println(reader.ready()); // print the char array for (int i = 0; i < 2; i++) { System.out.println("" + (char) reader.read()); } reader.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { PipedWriter writer = new PipedWriter(); PipedReader reader = new PipedReader(); try {/*from w w w . java 2 s . co m*/ // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // check if reader is ready to read System.out.println(reader.ready()); // print the char array for (int i = 0; i < 2; i++) { System.out.println("" + (char) reader.read()); } } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { PipedWriter writer = new PipedWriter(); PipedReader reader = new PipedReader(100); try {/*from w ww . j a v a2 s . c o m*/ // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // check if reader is ready to read System.out.println(reader.ready()); // print the char array for (int i = 0; i < 2; i++) { System.out.println("" + (char) reader.read()); } } catch (IOException ex) { ex.printStackTrace(); } }