java.nio.channels.GatheringByteChannel |
Known Indirect Subclasses |
The interface for channels that can write a set of buffers in a single operation. The corresponding interface for read operations is ScatteringByteChannel.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Writes bytes from a subset of the specified array of buffers to a
channel.
| |||||||||||
Writes bytes from all the given buffers to a channel.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface java.io.Closeable
| |||||||||||
From interface java.nio.channels.Channel
| |||||||||||
From interface java.nio.channels.WritableByteChannel
|
Writes bytes from a subset of the specified array of buffers to a
channel. The subset is defined by offset
and length
,
indicating the first buffer and the number of buffers to use.
If a write operation is in progress, subsequent threads will block until the write is completed and then contend for the ability to write.
buffers | the array of byte buffers that is the source for bytes written to the channel. |
---|---|
offset | the index of the first buffer in buffers to get bytes
from. |
length | the number of buffers to get bytes from. |
AsynchronousCloseException | if the channel is closed by another thread during this write operation. |
---|---|
ClosedByInterruptException | if another thread interrupts the calling thread while the operation is in progress. The interrupt state of the calling thread is set and the channel is closed. |
ClosedChannelException | if the channel is closed. |
IndexOutOfBoundsException | if offset < 0 or length < 0 , or if
offset + length is greater than the size of
buffers . |
IOException | if another I/O error occurs; details are in the message. |
NonWritableChannelException | if the channel was not opened for writing. |
Writes bytes from all the given buffers to a channel.
This method is equivalent to: write(buffers, 0, buffers.length);
buffers | the buffers containing bytes to be written. |
---|
AsynchronousCloseException | if the channel is closed by another thread during this write operation. |
---|---|
ClosedByInterruptException | if another thread interrupts the calling thread while the operation is in progress. The interrupt state of the calling thread is set and the channel is closed. |
ClosedChannelException | if the channel is closed. |
IndexOutOfBoundsException | if offset < 0 or length < 0 , or if
offset + length is greater than the size of
buffers . |
IOException | if another I/O error occurs; details are in the message. |
NonWritableChannelException | if the channel has not been opened in a mode that permits writing. |