Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

pipe broken...no more smoking....

807603Mar 14 2005 — edited Dec 18 2007
I have never been able to get the java.io.Pipe* classes to work properly. For instance, I have a BufferedReader that reads from a PipedInputStream. I also have a PrintStream that writes to PipedOutputStream. That PrintStream is set to System.out and System.err.

I am using the BufferedReader to read and put the text in a JTextArea, so that all System.out and System.err messages are displayed on the JTextArea.

I get an exception that says "Pipe broken"..and the java forums had a whopping 3 hits when searching. The pipe breaks a few seconds after the main method has finished (leaving the AWT threads running). If I sleep forever before the end of main, the pipe never breaks. Any thoughts on this.

java.io.IOException: Pipe broken
at java.io.PipedInputStream.read(PipedInputStream.java:224)
at java.io.PipedInputStream.read(PipedInputStream.java:274)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2008
Added on Mar 14 2005
10 comments
258 views