| java.nio.channels.GatheringByteChannel
All known Subclasses: java.nio.channels.SocketChannel, java.nio.channels.FileChannel, java.nio.channels.DatagramChannel,
GatheringByteChannel | public interface GatheringByteChannel extends WritableByteChannel(Code) | | The interface to channels that can write a set of buffers in a single
operation.
The corresponding interface for reads is called
ScatteringByteChannel .
|
Method Summary | |
public long | write(ByteBuffer[] buffers) Writes bytes from all the given buffers to the channel.
This method is equivalent to:
write(buffers, 0, buffers.length);
Parameters: buffers - the buffers containing bytes to be written. | public long | write(ByteBuffer[] buffers, int offset, int length) Writes a subset of the given bytes from the buffers to the channel.
This method attempts to write all of the remaining() bytes
from length byte buffers, in order, starting at
buffers[offset] . |
write | public long write(ByteBuffer[] buffers) throws IOException(Code) | | Writes bytes from all the given buffers to the channel.
This method is equivalent to:
write(buffers, 0, buffers.length);
Parameters: buffers - the buffers containing bytes to be written. the number of bytes actually written. throws: ClosedChannelException - if the channel is closed. throws: NonWritableChannelException - if the channel is open, but not in a mode that permitswriting. throws: ClosedByInterruptException - if the thread is interrupted in its IO operation by anotherthread closing the channel. throws: AsynchronousCloseException - if the write is interrupted by another thread sending anexplicit interrupt. throws: IOException - if some other type of exception occurs. Details are in themessage. |
write | public long write(ByteBuffer[] buffers, int offset, int length) throws IOException(Code) | | Writes a subset of the given bytes from the buffers to the channel.
This method attempts to write all of the remaining() bytes
from length byte buffers, in order, starting at
buffers[offset] . The number of bytes actually written is
returned.
If a write operation is in progress, subsequent threads will block until
the write is completed, and will then contend for the ability to write.
Parameters: buffers - the array of byte buffers containing the source of remainingbytes that will be attempted to be written. Parameters: offset - the index of the first buffer to write. Parameters: length - the number of buffers to write. the number of bytes actually written. throws: IndexOutOfBoundsException - if offset < 0 or > buffers.length; or length < 0 or >buffers.length - offset. throws: NonWritableChannelException - if the channel was not opened for writing. throws: ClosedChannelException - the channel is currently closed. throws: AsynchronousCloseException - the channel was closed by another thread while the write wasunderway. throws: ClosedByInterruptException - the thread was interrupted by another thread while the writewas underway. throws: IOException - if some other type of exception occurs. Details are in themessage. |
|
|