GatheringByteChannel (Java SE 15 & JDK 15) (original) (raw)

All Superinterfaces:

[AutoCloseable](../../lang/AutoCloseable.html "interface in java.lang"), [Channel](Channel.html "interface in java.nio.channels"), [Closeable](../../io/Closeable.html "interface in java.io"), [WritableByteChannel](WritableByteChannel.html "interface in java.nio.channels")

All Known Implementing Classes:

[DatagramChannel](DatagramChannel.html "class in java.nio.channels"), [FileChannel](FileChannel.html "class in java.nio.channels"), [Pipe.SinkChannel](Pipe.SinkChannel.html "class in java.nio.channels"), [SocketChannel](SocketChannel.html "class in java.nio.channels")


public interface GatheringByteChannel extends WritableByteChannel

A channel that can write bytes from a sequence of buffers.

A gathering write operation writes, in a single invocation, a sequence of bytes from one or more of a given sequence of buffers. Gathering writes are often useful when implementing network protocols or file formats that, for example, group data into segments consisting of one or more fixed-length headers followed by a variable-length body. Similar_scattering_ read operations are defined in the ScatteringByteChannel interface.

Since:

1.4

Modifier and Type Method Description
long write​(ByteBuffer[] srcs) Writes a sequence of bytes to this channel from the given buffers.
long write​(ByteBuffer[] srcs, int offset, int length) Writes a sequence of bytes to this channel from a subsequence of the given buffers.