|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdlife.sys.CopyOfNonblockingBufferedInputStream
public class CopyOfNonblockingBufferedInputStream
This class wraps a BufferedInputStream and provides several non-blocking calls for reading data from the stream. The wrapped BufferedInputStream must be an object that accurately supports the available() method.
| Constructor Summary | |
|---|---|
CopyOfNonblockingBufferedInputStream(BufferedInputStream bis)
Construct a new NonblockingBufferedInputStream around the provided BufferedInputStream. |
|
| Method Summary | |
|---|---|
void |
close()
Close the BufferedInputStream that is being used by this NonblockingBufferedInputStream. |
void |
flush()
Discard all of the currently available data in this NonblockingBufferedInputStream. |
String |
readAvailable()
Read all of the characters that are currently available from the BufferedInputStream and return them as a String. |
String |
readBytes(int count,
int timeout)
Read input from the BufferedInputStream up to the provided number of bytes if they become available before the specified timeout. |
String |
readToken(String delim,
int timeout)
Read input from the BufferedInputStream up to the provided delimiter if it becomes available before the specified timeout. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CopyOfNonblockingBufferedInputStream(BufferedInputStream bis)
bis - the BufferedInputStream.| Method Detail |
|---|
public void flush()
public String readAvailable()
public String readToken(String delim,
int timeout)
throws TimeoutException
delim - the delimiter that appears between the tokens.timeout - the maximum number of milliseconds to wait for the
delimiter to be read.
TimeoutException - if the delimiter is not read before timeout ms
have passed.
public String readBytes(int count,
int timeout)
throws TimeoutException
count - the number of bytes to try to read.timeout - the maximum number of ms to wait for the bytes to be read.
TimeoutException - if the requested number of bytes are not read
before the timeout.
public void close()
throws IOException
IOException - if the stream cannot be closed.
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||