Задача: "The Java Programming Language" Ken Arnold, James Gosling, David Holmes листинги, код, примеры из книги, исходники
Исходник: Глава 15, Ввод-Вывод (Chapter 15. Input-Output), Pipe class, язык: java [code #178, hits: 6304]
автор: - [добавлен: 15.09.2006]
  1. import java.io.IOException;
  2. import java.io.PipedWriter;
  3. import java.io.PipedReader;
  4.  
  5. /**
  6. * Created by IntelliJ IDEA.
  7. * User: me
  8. * Date: 13.09.2006
  9. * Time: 18:54:39
  10. * To change this template use File | Settings | File Templates.
  11. */
  12. public class Pipe {
  13. public static void main(String[] args) throws IOException {
  14. PipedWriter out = new PipedWriter();
  15. PipedReader in = new PipedReader(out);
  16.  
  17. TextGenerator data = new TextGenerator(out);
  18. data.start();
  19.  
  20. int ch;
  21. while ((ch = in.read()) != -1)
  22. System.out.println((char)ch);
  23. System.out.println();
  24. }
  25. }
  26.  
Тестировалось на: java 1.5.0_04

+добавить реализацию