|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
edu.rice.cs.util.InputStreamRedirector
public abstract class InputStreamRedirector
Redirects requests for input through the abstract method _getInput().
| Field Summary | |
|---|---|
protected java.util.ArrayList<java.lang.Character> |
_buffer
Buffer that stores the current set of bytes. |
| Constructor Summary | |
|---|---|
InputStreamRedirector()
Constructs a new InputStreamRedirector. |
|
| Method Summary | |
|---|---|
protected abstract java.lang.String |
_getInput()
This method gets called whenever input is requested from the stream and nothing is currently available. |
private void |
_readInputIntoBuffer()
Reads a single "line" of input into the buffer, i.e. |
int |
available()
|
int |
read()
Overrides the read() in PipedInputStream so that if the stream is empty, it asks for more input from _getInput(). |
int |
read(byte[] b)
Tries to fill b with bytes from the user, prompting for input only if the stream is already empty. |
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. |
| Methods inherited from class java.io.InputStream |
|---|
close, mark, markSupported, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected volatile java.util.ArrayList<java.lang.Character> _buffer
| Constructor Detail |
|---|
public InputStreamRedirector()
| Method Detail |
|---|
protected abstract java.lang.String _getInput()
throws java.io.IOException
java.io.IOException
private void _readInputIntoBuffer()
throws java.io.IOException
java.io.IOException
public int read(byte[] b)
throws java.io.IOException
read in class java.io.InputStreamb - the byte array to fill
java.io.IOException
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamb - the byte array to filloff - the offset in the byte arraylen - the number of characters to try to read
java.io.IOException
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - if an I/O exceptionpublic int available()
available in class java.io.InputStream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||