List of usage examples for java.io PipedReader connect
public void connect(PipedWriter src) throws IOException
src
. From source file:Main.java
public static void main(String[] args) { try {//from w w w . ja v a 2 s . 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) { PipedWriter writer = new PipedWriter(); PipedReader reader = new PipedReader(); try {/*from ww w .j a v a2 s .c om*/ // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // read what we wrote 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(); try {/*from ww w .j a v a 2s . c o m*/ // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // read what we wrote 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) { try {/*from ww w . j av a 2s . c om*/ 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 www . j av 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(); } }
From source file:Main.java
public static void main(String[] args) { PipedWriter writer = new PipedWriter(); PipedReader reader = new PipedReader(); try {/*from w w w . ja v a 2s. co m*/ // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // read what we wrote for (int i = 0; i < 2; i++) { System.out.println((char) reader.read()); } reader.close(); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { PipedWriter writer = new PipedWriter(); PipedReader reader = new PipedReader(); try {//from ww w . j a va 2s. co m // connect the reader and the writer reader.connect(writer); writer.write(70); writer.write(71); // read into a char array char[] b = new char[2]; reader.read(b, 0, 2); // print the char array for (int i = 0; i < 2; i++) { System.out.println(b[i]); } } 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 www . j ava 2 s .c om // 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(); } }