new PipedWriter() : PrintWriter « java.io « Java by API






new PipedWriter()

  
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) {
    }
  }
}

   
    
  








Related examples in the same category

1.new PrintWriter(BufferedWriter, boolean autoFlush)
2.new PrintWriter(Writer out)
3.PrintWriter: close()
4.PrintWriter: print(char c)
5.PrintWriter: print(int i)
6.PrintWriter: println(Object x)
7.PrintWriter: println(String x)
8.PrintWriter: println(char x)
9.PrintWriter: println(double x)
10.PrintWriter: println(float x)
11.PrintWriter: println(int x)
12.PrintWriter: println(long x)
13.PrintWriter: println()
14.Writer: write(char[] cbuf)