Задача: "The Java Programming Language" Ken Arnold, James Gosling, David Holmes листинги, код, примеры из книги, исходники
Исходник: Глава 15, Ввод-Вывод (Chapter 15. Input-Output), TextGenerator class, язык: java [code #177, hits: 6651]
автор: - [добавлен: 15.09.2006]
  1. import java.io.Writer;
  2. import java.io.IOException;
  3.  
  4. /**
  5. * Created by IntelliJ IDEA.
  6. * User: me
  7. * Date: 13.09.2006
  8. * Time: 18:47:36
  9. * To change this template use File | Settings | File Templates.
  10. */
  11. public class TextGenerator extends Thread {
  12. private Writer out;
  13.  
  14. public TextGenerator(Writer out) {
  15. this.out = out;
  16. }
  17.  
  18. public void run() {
  19. try {
  20. try {
  21. for (int c = 1; c <= 256; c++)
  22. out.write((char)c);
  23. } finally {
  24. out.close();
  25. }
  26. } catch (IOException e) {
  27. getThreadGroup().uncaughtException(this, e);
  28. }
  29. }
  30. }
  31.  
Тестировалось на: java 1.5.0_04

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