Closeable
, AutoCloseable
NonBlockingInputStreamImpl
, NonBlockingPumpInputStream
public abstract class NonBlockingInputStream extends InputStream
Modifier and Type | Field | Description |
---|---|---|
static int |
EOF |
|
static int |
READ_EXPIRED |
Constructor | Description |
---|---|
NonBlockingInputStream() |
Modifier and Type | Method | Description |
---|---|---|
int |
peek(long timeout) |
Peeks to see if there is a byte waiting in the input stream without
actually consuming the byte.
|
int |
read() |
Reads the next byte of data from the input stream.
|
int |
read(byte[] b,
int off,
int len) |
|
int |
read(long timeout) |
Attempts to read a character from the input stream for a specific
period of time.
|
abstract int |
read(long timeout,
boolean isPeek) |
|
int |
readBuffered(byte[] b) |
|
void |
shutdown() |
Shuts down the thread that is handling blocking I/O if any.
|
available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
public static final int EOF
public static final int READ_EXPIRED
public int read() throws IOException
int
in the range 0
to
255
. If no byte is available because the end of the stream
has been reached, the value -1
is returned. This method
blocks until input data is available, the end of the stream is detected,
or an exception is thrown.read
in class InputStream
-1
if the end of the
stream is reached.IOException
- if an I/O error occurs.public int peek(long timeout) throws IOException
timeout
- The amount of time to wait, 0 == foreverIOException
- if an I/O error occurs.public int read(long timeout) throws IOException
timeout
- The amount of time to wait for the characterIOException
- if an I/O error occurs.public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int readBuffered(byte[] b) throws IOException
IOException
public void shutdown()
public abstract int read(long timeout, boolean isPeek) throws IOException
IOException
Copyright © 2020. All rights reserved.