Package org.jline.utils
Class NonBlockingPumpInputStream
java.lang.Object
java.io.InputStream
org.jline.utils.NonBlockingInputStream
org.jline.utils.NonBlockingPumpInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final intprivate IOExceptionprivate final OutputStreamprivate final ByteBufferprivate final ByteBufferprivate booleanFields inherited from class org.jline.utils.NonBlockingInputStream
EOF, READ_EXPIRED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintprotected voidvoidclose()Closes this input stream and marks it as closed.voidSignals that the write side has been closed and no more data will be written.(package private) voidflush()intread(long timeout, boolean isPeek) intreadBuffered(byte[] b, int off, int len, long timeout) private static booleanrewind(ByteBuffer buffer, ByteBuffer other) voidsetIoException(IOException exception) private intwait(ByteBuffer buffer, long timeout) (package private) voidwrite(byte[] cbuf, int off, int len) Methods inherited from class org.jline.utils.NonBlockingInputStream
checkClosed, peek, read, read, read, readBuffered, readBuffered, shutdownMethods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
DEFAULT_BUFFER_SIZE
private static final int DEFAULT_BUFFER_SIZE- See Also:
-
readBuffer
-
writeBuffer
-
output
-
closed
private boolean closed -
writerClosed
private boolean writerClosed -
ioException
-
-
Constructor Details
-
NonBlockingPumpInputStream
public NonBlockingPumpInputStream() -
NonBlockingPumpInputStream
public NonBlockingPumpInputStream(int bufferSize)
-
-
Method Details
-
getOutputStream
-
wait
- Throws:
IOException
-
rewind
-
available
public int available()- Overrides:
availablein classInputStream
-
read
- Specified by:
readin classNonBlockingInputStream- Throws:
IOException
-
readBuffered
- Overrides:
readBufferedin classNonBlockingInputStream- Throws:
IOException
-
setIoException
-
checkIoException
- Throws:
IOException
-
write
- Throws:
IOException
-
flush
void flush() -
closeWriter
public void closeWriter()Signals that the write side has been closed and no more data will be written. Any buffered data can still be read; reads will returnNonBlockingInputStream.EOFonly after all buffered data has been consumed. This is analogous to closing the write end of a Unix pipe: the read end drains remaining data before seeing EOF. -
close
Description copied from class:NonBlockingInputStreamCloses this input stream 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 classNonBlockingInputStream- Throws:
IOException- if an I/O error occurs
-