Java by API/java.io/PipedReader
Версия от 17:43, 31 мая 2010; (обсуждение)
new PipedReader(PipedWriter src)
import java.io.IOException;
import java.io.PipedReader;
import java.io.PipedWriter;
public class Main {
public static void main(String[] args) throws IOException {
PipedWriter pw = new PipedWriter();
PipedReader pr = new PipedReader(pw);
int ch;
try {
for (int i = 0; i < 15; i++)
pw.write(" A" + i + "\n");
while ((ch = pr.read()) != -1)
System.out.print((char) ch);
} catch (IOException e) {
}
}
}
PipedReader: read()
import java.io.IOException;
import java.io.PipedReader;
import java.io.PipedWriter;
public class Main {
public static void main(String[] args) throws IOException {
PipedWriter pw = new PipedWriter();
PipedReader pr = new PipedReader(pw);
int ch;
try {
for (int i = 0; i < 15; i++)
pw.write(" A" + i + "\n");
while ((ch = pr.read()) != -1)
System.out.print((char) ch);
} catch (IOException e) {
}
}
}