Java Reference
In-Depth Information
Each arrow points from a given interface to an interface that it extends. The
ReadableByteChannel
in-
terface provides for reading from a file into a single
ByteBuffer
and the
WritableByteChannel
provides
for writing the contents of a
ByteBuffer
to a file. The
ByteChannel
interface simply combines the opera-
tions specified by the
ReadableByteChannel
and
WritableByteChannel
interfaces without declaring any
additional methods. The
ScatteringByteChannel
interface extends the
ReadableByteChannel
interface
by adding methods that allow data to be read and distributed among several separate buffers in a single oper-
ation. The
GatheringByteChannel
interface adds methods to those of the
WritableByteChannel
interface
to permit writing from a number of separate buffers in a single operation.
The
SeekableByteChannel
interface provides the most comprehensive set of methods for file operations
providing random access to a file for both reading and writing.
The
InterruptibleChannel
interface is implemented by classes encapsulating channels for network
sockets and other interruptible devices; I concentrate on file operations in this topic, so I won't discuss this
interface further.
Channel Operations