StreamChannel. Read and write operations will block until some data may be transferred.
Once any amount of data is read or written, the operation will return. If a read timeout is specified, then the read methods
will throw a ReadTimeoutException if the timeout expires without reading any data. If a write timeout is specified, then the write methods
will throw a WriteTimeoutException if the timeout expires without writing any data.
| Modifier and Type | Field and Description |
|---|---|
| private final StreamChannel | |
| private volatile long | |
| private volatile long |
| Access | Constructor and Description |
|---|---|
| public | BlockingByteChannel(final StreamChannel
the channel to forward I/O operations to delegate)Construct a new instance. |
| public | BlockingByteChannel(final StreamChannel
the channel to forward I/O operations to delegate, final long the read/write timeout timeout, final TimeUnit the read/write timeout unit timeoutUnit)Construct a new instance. |
| public | BlockingByteChannel(final StreamChannel
the channel to forward I/O operations to delegate, final long the read timeout readTimeout, final TimeUnit the read timeout unit readTimeoutUnit, final long the write timeout writeTimeout, final TimeUnit the write timeout unit writeTimeoutUnit)Construct a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | flush()
Implements java. Flushes this stream by writing any buffered output to the underlying stream. |
| public boolean | |
| public long | Returns: the number of bytes actually read (will be greater than zero)the destination buffers dsts, final int the offset into the destination buffer array offset, final int the number of buffers to read into length)Implements java. Perform a blocking, scattering read operation. |
| public long | Returns: the number of bytes actually read (will be greater than zero)the destination buffers dsts)Implements java. Perform a blocking, scattering read operation. |
| public int | Returns: the number of bytes actually read (will be greater than zero)the destination buffer dst)Implements java. Perform a blocking read operation. |
| public void | setReadTimeout(long
the read timeout readTimeout, TimeUnit the read timeout unit readTimeoutUnit)Set the read timeout. |
| public void | setWriteTimeout(long
the write timeout writeTimeout, TimeUnit the write timeout unit writeTimeoutUnit)Set the write timeout. |
| public long | Returns: the number of bytes actually written (will be greater than zero)the source buffers srcs, final int the offset into the destination buffer array offset, final int the number of buffers to write from length)Implements java. Perform a blocking, gathering write operation. |
| public long | Returns: the number of bytes actually written (will be greater than zero)the source buffers srcs)Implements java. Perform a blocking, gathering write operation. |
| public int | Returns: the number of bytes actually written (will be greater than zero)the source buffer src)Implements java. Perform a blocking write operation. |
| delegate | back to summary |
|---|---|
| private final StreamChannel delegate | |
| readTimeout | back to summary |
|---|---|
| private volatile long readTimeout | |
| writeTimeout | back to summary |
|---|---|
| private volatile long writeTimeout | |
| BlockingByteChannel | back to summary |
|---|---|
| public BlockingByteChannel(final StreamChannel delegate) Construct a new instance.
| |
| BlockingByteChannel | back to summary |
|---|---|
| public BlockingByteChannel(final StreamChannel delegate, final long timeout, final TimeUnit timeoutUnit) Construct a new instance.
| |
| BlockingByteChannel | back to summary |
|---|---|
| public BlockingByteChannel(final StreamChannel delegate, final long readTimeout, final TimeUnit readTimeoutUnit, final long writeTimeout, final TimeUnit writeTimeoutUnit) Construct a new instance.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this channel. After a channel is closed, any further attempt to invoke I/O
operations upon it will cause a If this channel is already closed then invoking this method has no effect. This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Implements java. Doc from java. Flushes this stream by writing any buffered output to the underlying stream.
| |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
| |
| read | back to summary |
|---|---|
| public long read(final ByteBuffer[] dsts, final int offset, final int length) throws IOException Implements java. Perform a blocking, scattering read operation.
| |
| read | back to summary |
|---|---|
| public long read(final ByteBuffer[] dsts) throws IOException Implements java. Perform a blocking, scattering read operation.
| |
| read | back to summary |
|---|---|
| public int read(final ByteBuffer dst) throws IOException Implements java. Perform a blocking read operation.
| |
| setReadTimeout | back to summary |
|---|---|
| public void setReadTimeout(long readTimeout, TimeUnit readTimeoutUnit) Set the read timeout.
| |
| setWriteTimeout | back to summary |
|---|---|
| public void setWriteTimeout(long writeTimeout, TimeUnit writeTimeoutUnit) Set the write timeout.
| |
| write | back to summary |
|---|---|
| public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException Implements java. Perform a blocking, gathering write operation.
| |
| write | back to summary |
|---|---|
| public long write(final ByteBuffer[] srcs) throws IOException Implements java. Perform a blocking, gathering write operation.
| |
| write | back to summary |
|---|---|
| public int write(final ByteBuffer src) throws IOException Implements java. Perform a blocking write operation.
| |