GraphLab Project

graphlab.plugins.commandline
Class ShellConsole.BlockingPipedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.PipedInputStream
          extended by graphlab.plugins.commandline.ShellConsole.BlockingPipedInputStream
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
ShellConsole

public static class ShellConsole.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 MyConsole 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
 
Fields inherited from class java.io.PipedInputStream
buffer, in, out, PIPE_SIZE
 
Constructor Summary
ShellConsole.BlockingPipedInputStream(java.io.PipedOutputStream pout)
           
 
Method Summary
 void close()
           
 int read()
           
 
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
 

Constructor Detail

ShellConsole.BlockingPipedInputStream

public ShellConsole.BlockingPipedInputStream(java.io.PipedOutputStream pout)
                                      throws java.io.IOException
Throws:
java.io.IOException
Method Detail

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.PipedInputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.PipedInputStream
Throws:
java.io.IOException

GraphLab Project