FileDocCategorySizeDatePackage
GatheringByteChannel.javaAPI DocAndroid 1.5 API4406Wed May 06 22:41:04 BST 2009java.nio.channels

GatheringByteChannel

public interface GatheringByteChannel implements WritableByteChannel
The interface for channels that can write a set of buffers in a single operation. The corresponding interface for read operations is {@link ScatteringByteChannel}.
since
Android 1.0

Fields Summary
Constructors Summary
Methods Summary
public longwrite(java.nio.ByteBuffer[] buffers)
Writes bytes from all the given buffers to a channel.

This method is equivalent to: {@code write(buffers, 0, buffers.length);}

param
buffers the buffers containing bytes to be written.
return
the number of bytes actually written.
throws
AsynchronousCloseException if the channel is closed by another thread during this write operation.
throws
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.
throws
ClosedChannelException if the channel is closed.
throws
IndexOutOfBoundsException if {@code offset < 0} or {@code length < 0}, or if {@code offset + length} is greater than the size of {@code buffers}.
throws
IOException if another I/O error occurs; details are in the message.
throws
NonWritableChannelException if the channel has not been opened in a mode that permits writing.
since
Android 1.0

public longwrite(java.nio.ByteBuffer[] buffers, int offset, int length)
Writes bytes from a subset of the specified array of buffers to a channel. The subset is defined by {@code offset} and {@code 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.

param
buffers the array of byte buffers that is the source for bytes written to the channel.
param
offset the index of the first buffer in {@code buffers }to get bytes from.
param
length the number of buffers to get bytes from.
return
the number of bytes actually written.
throws
AsynchronousCloseException if the channel is closed by another thread during this write operation.
throws
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.
throws
ClosedChannelException if the channel is closed.
throws
IndexOutOfBoundsException if {@code offset < 0} or {@code length < 0}, or if {@code offset + length} is greater than the size of {@code buffers}.
throws
IOException if another I/O error occurs; details are in the message.
throws
NonWritableChannelException if the channel was not opened for writing.
since
Android 1.0