Class NonBlockingPumpReader
java.lang.Object
java.io.Reader
org.jline.utils.NonBlockingReader
org.jline.utils.NonBlockingPumpReader
- All Implemented Interfaces:
Closeable, AutoCloseable, Readable
-
Field Summary
Fields inherited from class NonBlockingReader
EOF, READ_EXPIRED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()Closes this reader and marks it as closed.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) booleanready()Methods inherited from class NonBlockingReader
checkClosed, peek, read, read, read, readBuffered, readBuffered, shutdownMethods inherited from class Reader
mark, markSupported, nullReader, of, read, read, readAllAsString, readAllLines, reset, skip, transferTo
-
Constructor Details
-
NonBlockingPumpReader
public NonBlockingPumpReader() -
NonBlockingPumpReader
public NonBlockingPumpReader(int bufferSize)
-
-
Method Details
-
getWriter
-
ready
-
available
public int available()- Overrides:
availablein classNonBlockingReader
-
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
-
close
Description copied from class:NonBlockingReaderCloses this reader and marks it as closed.Subsequent read operations behavior depends on the
PROP_CLOSE_MODEsetting:"strict"- ThrowClosedException"warn"- Log a warning but continue (default in JLine 3.x)"lenient"- Silently allow access
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classNonBlockingReader- Throws:
IOException- if an I/O error occurs
-