| java.lang.Object java.io.InputStream edu.rice.cs.util.InputStreamRedirector
InputStreamRedirector | abstract public class InputStreamRedirector extends InputStream (Code) | | Redirects requests for input through the abstract method _getInput().
version: $Id: InputStreamRedirector.java 4255 2007-08-28 19:17:37Z mgricken $ |
Method Summary | |
abstract protected String | _getInput() This method gets called whenever input is requested from the stream and
nothing is currently available. | public int | available() the number of characters available in this stream. | public synchronized int | read(byte[] b) Tries to fill b with bytes from the user, prompting for input only if the stream is already empty. | public synchronized int | read(byte[] b, int off, int len) Tries to fill b with bytes from the user, prompting for input only if the stream is already empty. | public synchronized int | read() Overrides the read() in PipedInputStream so that if the stream is empty, it asks for more input from _getInput(). |
_buffer | protected ArrayList<Character> _buffer(Code) | | Buffer that stores the current set of bytes.
TODO: perhaps this should use an array for efficiency
This is only used as a char queue.
|
InputStreamRedirector | public InputStreamRedirector()(Code) | | Constructs a new InputStreamRedirector.
|
_getInput | abstract protected String _getInput() throws IOException(Code) | | This method gets called whenever input is requested from the stream and
nothing is currently available. Subclasses should return the appropriate
input to feed to the input stream. When using a readLine() method, be sure
to append a newline to the end of the input.
the input to the stream, not the empty string |
available | public int available()(Code) | | the number of characters available in this stream. |
read | public synchronized int read(byte[] b) throws IOException(Code) | | Tries to fill b with bytes from the user, prompting for input only if the stream is already empty.
Parameters: b - the byte array to fill the number of bytes successfully read |
read | public synchronized int read(byte[] b, int off, int len) throws IOException(Code) | | Tries to fill b with bytes from the user, prompting for input only if the stream is already empty.
Parameters: b - the byte array to fill Parameters: off - the offset in the byte array Parameters: len - the number of characters to try to read the number of bytes successfully read |
read | public synchronized int read() throws IOException(Code) | | Overrides the read() in PipedInputStream so that if the stream is empty, it asks for more input from _getInput().
the next character in the stream throws: IOException - if an I/O exception |
|
|