Class NonBlockingReaderImpl

java.lang.Object
java.io.Reader
org.jline.utils.NonBlockingReader
org.jline.utils.NonBlockingReaderImpl
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class NonBlockingReaderImpl extends NonBlockingReader
This class wraps a regular reader and allows it to appear as if it is non-blocking; that is, reads can be performed against it that timeout if no data is seen for a period of time. This effect is achieved by having a separate thread perform all non-blocking read requests and then waiting on the thread to complete.

VERY IMPORTANT NOTES

  • This class is not thread safe. It expects at most one reader.
  • The shutdown() method must be called in order to shut down the thread that handles blocking I/O.
Since:
2.7
Author:
Scott C. Gray <scottgray1@gmail.com>