Package org.jline.utils
Class NonBlocking.NonBlockingInputStreamReader
java.lang.Object
java.io.Reader
org.jline.utils.NonBlockingReader
org.jline.utils.NonBlocking.NonBlockingInputStreamReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
- Enclosing class:
NonBlocking
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ByteBufferprivate final CharBufferprivate final CharsetDecoderprivate final NonBlockingInputStreamFields inherited from class org.jline.utils.NonBlockingReader
EOF, READ_EXPIRED -
Constructor Summary
ConstructorsConstructorDescriptionNonBlockingInputStreamReader(NonBlockingInputStream inputStream, Charset encoding) NonBlockingInputStreamReader(NonBlockingInputStream input, CharsetDecoder decoder) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected intread(long timeout, boolean isPeek) Attempts to read a character from the input stream for a specific period of time.intreadBuffered(char[] b, int off, int len, long timeout) voidshutdown()Shuts down the thread that is handling blocking I/O.Methods inherited from class org.jline.utils.NonBlockingReader
available, peek, read, read, read, readBuffered, readBufferedMethods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, ready, reset, skip, transferTo
-
Field Details
-
input
-
decoder
-
bytes
-
chars
-
-
Constructor Details
-
NonBlockingInputStreamReader
-
NonBlockingInputStreamReader
-
-
Method Details
-
read
Description copied from class:NonBlockingReaderAttempts to read a character from the input stream for a specific period of time.- Specified by:
readin classNonBlockingReader- Parameters:
timeout- The amount of time to wait for the characterisPeek-trueif the character read must not be consumed- Returns:
- The character read, -1 if EOF is reached, or -2 if the read timed out.
- Throws:
IOException- if anything wrong happens
-
readBuffered
- Specified by:
readBufferedin classNonBlockingReader- Throws:
IOException
-
shutdown
public void shutdown()Description copied from class:NonBlockingReaderShuts 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.- Overrides:
shutdownin classNonBlockingReader
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-