<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FFile%2FPipedInputStream</id>
		<title>Java Tutorial/File/PipedInputStream - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FFile%2FPipedInputStream"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/File/PipedInputStream&amp;action=history"/>
		<updated>2026-04-10T00:58:38Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/File/PipedInputStream&amp;diff=5390&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/File/PipedInputStream&amp;diff=5390&amp;oldid=prev"/>
				<updated>2010-06-01T05:20:15Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 05:20, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/File/PipedInputStream&amp;diff=5389&amp;oldid=prev</id>
		<title> в 17:44, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/File/PipedInputStream&amp;diff=5389&amp;oldid=prev"/>
				<updated>2010-05-31T17:44:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==  Piped IO ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.PipedInputStream;&lt;br /&gt;
import java.io.PipedOutputStream;&lt;br /&gt;
class PipedIOApp {&lt;br /&gt;
  public static void main(String args[]) {&lt;br /&gt;
    Thread thread1 = new Thread(new PipeOutput(&amp;quot;Producer&amp;quot;));&lt;br /&gt;
    Thread thread2 = new Thread(new PipeInput(&amp;quot;Consumer&amp;quot;));&lt;br /&gt;
    thread1.start();&lt;br /&gt;
    thread2.start();&lt;br /&gt;
    boolean thread1IsAlive = true;&lt;br /&gt;
    boolean thread2IsAlive = true;&lt;br /&gt;
    do {&lt;br /&gt;
      if (thread1IsAlive &amp;amp;&amp;amp; !thread1.isAlive()) {&lt;br /&gt;
        thread1IsAlive = false;&lt;br /&gt;
      }&lt;br /&gt;
      if (thread2IsAlive &amp;amp;&amp;amp; !thread2.isAlive()) {&lt;br /&gt;
        thread2IsAlive = false;&lt;br /&gt;
      }&lt;br /&gt;
    } while (thread1IsAlive || thread2IsAlive);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class PipeIO {&lt;br /&gt;
  static PipedOutputStream outputPipe = new PipedOutputStream();&lt;br /&gt;
  static PipedInputStream inputPipe = new PipedInputStream();&lt;br /&gt;
  static {&lt;br /&gt;
    try {&lt;br /&gt;
      outputPipe.connect(inputPipe);&lt;br /&gt;
    } catch (IOException ex) {&lt;br /&gt;
      System.out.println(&amp;quot;IOException in static initializer&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  String name;&lt;br /&gt;
  public PipeIO(String id) {&lt;br /&gt;
    name = id;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class PipeOutput extends PipeIO implements Runnable {&lt;br /&gt;
  public PipeOutput(String id) {&lt;br /&gt;
    super(id);&lt;br /&gt;
  }&lt;br /&gt;
  public void run() {&lt;br /&gt;
    String s = &amp;quot;This is a test.&amp;quot;;&lt;br /&gt;
    try {&lt;br /&gt;
      for (int i = 0; i &amp;lt; s.length(); ++i) {&lt;br /&gt;
        outputPipe.write(s.charAt(i));&lt;br /&gt;
        System.out.println(name + &amp;quot; wrote &amp;quot; + s.charAt(i));&lt;br /&gt;
      }&lt;br /&gt;
      outputPipe.write(&amp;quot;!&amp;quot;);&lt;br /&gt;
    } catch (IOException ex) {&lt;br /&gt;
      System.out.println(&amp;quot;IOException in PipeOutput&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
class PipeInput extends PipeIO implements Runnable {&lt;br /&gt;
  public PipeInput(String id) {&lt;br /&gt;
    super(id);&lt;br /&gt;
  }&lt;br /&gt;
  public void run() {&lt;br /&gt;
    boolean eof = false;&lt;br /&gt;
    try {&lt;br /&gt;
      while (!eof) {&lt;br /&gt;
        int inChar = inputPipe.read();&lt;br /&gt;
        if (inChar != -1) {&lt;br /&gt;
          char ch = (char) inChar;&lt;br /&gt;
          if (ch == &amp;quot;!&amp;quot;) {&lt;br /&gt;
            eof = true;&lt;br /&gt;
            break;&lt;br /&gt;
          } else&lt;br /&gt;
            System.out.println(name + &amp;quot; read &amp;quot; + ch);&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    } catch (IOException ex) {&lt;br /&gt;
      System.out.println(&amp;quot;IOException in PipeOutput&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>