public class NonBlockingInputStreamImpl extends NonBlockingInputStream
VERY IMPORTANT NOTES
shutdown() method must be called in order to shut down
the thread that handles blocking I/O.
EOF, READ_EXPIRED| Constructor and Description |
|---|
NonBlockingInputStreamImpl(String name,
InputStream in)
Creates a
NonBlockingReader out of a normal blocking
reader. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
read(long timeout,
boolean isPeek)
Attempts to read a byte from the input stream for a specific
period of time.
|
void |
shutdown()
Shuts down the thread that is handling blocking I/O.
|
peek, read, read, readavailable, mark, markSupported, read, reset, skippublic NonBlockingInputStreamImpl(String name, InputStream 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
shutdown() method must be called in order to shut this thread down.name - The stream namein - The reader to wrappublic void shutdown()
shutdown in class NonBlockingInputStreampublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int read(long timeout,
boolean isPeek)
throws IOException
read in class NonBlockingInputStreamtimeout - The amount of time to wait for the characterisPeek - trueif the byte read must not be consumedIOException - if anything wrong happensCopyright © 2018. All rights reserved.