VERY IMPORTANT NOTES
shutdown() method must be called in order to shut down
the thread that handles blocking I/O.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private IOException | |
| private InputStream | |
| private String | |
| private Thread | |
| private long | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | NonBlockingInputStreamImpl(String
The stream name name, InputStream The reader to wrap in)Creates a |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. Closes this input stream and releases any system resources associated with the stream. |
| public synchronized int | Returns: The byte read, -1 if EOF is reached, or -2 if the read timed out.The amount of time to wait for the character timeout, boolean trueif the byte read must not be consumedImplements abstract jdk. Attempts to read a byte from the input stream for a specific period of time. |
| private void | |
| public synchronized void | shutdown()
Overrides jdk. Shuts down the thread that is handling blocking I/O. |
| private synchronized void |
| b | back to summary |
|---|---|
| private int b | |
| exception | back to summary |
|---|---|
| private IOException exception | |
| in | back to summary |
|---|---|
| private InputStream in | |
| name | back to summary |
|---|---|
| private String name | |
| thread | back to summary |
|---|---|
| private Thread thread | |
| threadDelay | back to summary |
|---|---|
| private long threadDelay | |
| threadIsReading | back to summary |
|---|---|
| private boolean threadIsReading | |
| NonBlockingInputStreamImpl | back to summary |
|---|---|
| public NonBlockingInputStreamImpl(String name, InputStream in) Creates a
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| read | back to summary |
|---|---|
| public synchronized int read(long timeout, boolean isPeek) throws IOException Implements abstract jdk. Attempts to read a byte from the input stream for a specific period of time.
| |
| run | back to summary |
|---|---|
| private void run() | |
| shutdown | back to summary |
|---|---|
| public synchronized void shutdown() Overrides jdk. Shuts down the thread that is handling blocking I/O. Note that if the thread is currently blocked waiting for I/O it will not actually shut down until the I/O is received. | |
| startReadingThreadIfNeeded | back to summary |
|---|---|
| private synchronized void startReadingThreadIfNeeded() | |