mdw.nbio
クラス NonblockingInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--mdw.nbio.NonblockingInputStream
- public abstract class NonblockingInputStream
- extends java.io.InputStream
A NonblockingInputStream is an InputStream which implements nonblocking
semantics. The only additional method is nbRead() which performs a
nonblocking read of one byte. The read(byte[]) and read(byte[], int, int)
methods are also nonblocking. The standard read(byte) call is blocking
as there is no way to indicate that nothing was read (a -1 means
an error occurred).
メソッドの概要 |
abstract int |
available()
|
abstract void |
close()
|
abstract int |
nbRead()
Perform a non-blocking read of one byte from this input stream.
|
abstract int |
read()
Perform a blocking read of one byte from this input stream.
|
abstract int |
read(byte[] b)
Perform a non-blocking read of up to b.length bytes
from the underlying stream. |
abstract int |
read(byte[] b,
int off,
int len)
Perform a non-blocking read of up to len bytes from the
underlying stream into the byte array b starting at offset
off . |
abstract long |
skip(long n)
Skip n bytes of input. |
クラス java.io.InputStream から継承したメソッド |
mark, markSupported, reset |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NonblockingInputStream
public NonblockingInputStream()
read
public abstract int read()
throws java.io.IOException
- Perform a blocking read of one byte from this input stream.
Returns -1 if the end of the stream has been reached.
Use nbRead() to perform a non-blocking read of one byte.
- オーバーライド:
- クラス
java.io.InputStream
内の read
nbRead
public abstract int nbRead()
throws java.io.IOException
- Perform a non-blocking read of one byte from this input stream.
Returns -1 if no data is available, or throws an EOFException if the
end of the stream has been reached. Use read() to perform a blocking
read of one byte.
read
public abstract int read(byte[] b)
throws java.io.IOException
- Perform a non-blocking read of up to
b.length
bytes
from the underlying stream.
- オーバーライド:
- クラス
java.io.InputStream
内の read
- 戻り値:
- The total number of bytes read into the buffer, 0 if
no data was available, or -1 if the end of the stream has
been reached.
read
public abstract int read(byte[] b,
int off,
int len)
throws java.io.IOException
- Perform a non-blocking read of up to
len
bytes from the
underlying stream into the byte array b
starting at offset
off
.
- オーバーライド:
- クラス
java.io.InputStream
内の read
- 戻り値:
- The total number of bytes read into the buffer, 0 if
no data was available, or -1 if the end of the stream has
been reached.
skip
public abstract long skip(long n)
throws java.io.IOException
- Skip n bytes of input. This is a blocking operation.
- オーバーライド:
- クラス
java.io.InputStream
内の skip
available
public abstract int available()
throws java.io.IOException
- オーバーライド:
- クラス
java.io.InputStream
内の available
close
public abstract void close()
throws java.io.IOException
- オーバーライド:
- クラス
java.io.InputStream
内の close