public class NonBlockingReaderImpl extends NonBlockingReader
VERY IMPORTANT NOTES
NonBlockingReaderImpl.shutdown() method must be called in order to shut down
the thread that handles blocking I/O.
| Modifier and Type | Field and Description |
|---|---|
static int |
READ_EXPIRED |
EOF| Constructor and Description |
|---|
NonBlockingReaderImpl(String name,
Reader in)
Creates a
NonBlockingReader out of a normal blocking
reader. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
close() |
protected int |
read(long timeout,
boolean isPeek)
Attempts to read a character from the input stream for a specific
period of time.
|
int |
readBuffered(char[] b,
int off,
int len,
long timeout) |
boolean |
ready() |
void |
shutdown()
Shuts down the thread that is handling blocking I/O.
|
available, peek, read, read, read, readBuffered, readBufferedmark, markSupported, nullReader, read, read, reset, skip, transferTopublic static final int READ_EXPIRED
public NonBlockingReaderImpl(String name, Reader in)
NonBlockingReader out of a normal blocking
reader. Note that this call also spawn a separate thread to perform the
blocking I/O on behalf of the thread that is using this class. The
NonBlockingReaderImpl.shutdown() method must be called in order to shut this thread down.name - The reader namein - The reader to wrappublic void shutdown()
shutdown in class NonBlockingReaderpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class ReaderIOExceptionpublic boolean ready()
throws IOException
ready in class ReaderIOExceptionpublic int readBuffered(char[] b,
int off,
int len,
long timeout)
throws IOException
readBuffered in class NonBlockingReaderIOExceptionprotected int read(long timeout,
boolean isPeek)
throws IOException
read in class NonBlockingReadertimeout - The amount of time to wait for the characterisPeek - trueif the character read must not be consumedIOException - if anything wrong happenspublic void clear()
throws IOException
IOException