Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.emory.mathcs.util.swing
Class JConsole.BlockingPipedInputStream  view JConsole.BlockingPipedInputStream download JConsole.BlockingPipedInputStream.java

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.PipedInputStream
          extended byedu.emory.mathcs.util.swing.JConsole.BlockingPipedInputStream
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
JConsole

public static class JConsole.BlockingPipedInputStream
extends java.io.PipedInputStream

The overridden read method in this class will not throw "Broken pipe" IOExceptions; It will simply wait for new writers and data. This is used by the JConsole internal read thread to allow writers in different (and in particular ephemeral) threads to write to the pipe. It also checks a little more frequently than the original read(). Warning: read() will not even error on a read to an explicitly closed pipe (override closed to for that).


Field Summary
(package private)  boolean closed
           
 
Fields inherited from class java.io.PipedInputStream
buffer, in, out, PIPE_SIZE
 
Constructor Summary
JConsole.BlockingPipedInputStream(java.io.PipedOutputStream pout)
           
 
Method Summary
 void close()
          This methods closes the stream so that no more data can be read from it.
 int read()
          This method reads one byte from the stream.
 
Methods inherited from class java.io.PipedInputStream
available, connect, read, receive
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closed

boolean closed
Constructor Detail

JConsole.BlockingPipedInputStream

public JConsole.BlockingPipedInputStream(java.io.PipedOutputStream pout)
                                  throws java.io.IOException
Method Detail

read

public int read()
         throws java.io.IOException
Description copied from class: java.io.PipedInputStream
This method reads one byte from the stream. -1 is returned to indicated that no bytes can be read because the end of the stream was reached. If the stream is already closed, a -1 will again be returned to indicate the end of the stream.

This method will block if no byte is available to be read.


close

public void close()
           throws java.io.IOException
Description copied from class: java.io.PipedInputStream
This methods closes the stream so that no more data can be read from it.