See: Description
Interface | Description |
---|---|
ByteChannel |
A channel that can read and write bytes.
|
Channel |
A nexus for I/O operations.
|
ReadableByteChannel |
A channel that can read bytes.
|
SeekableByteChannel |
A byte channel that maintains a current position and allows the
position to be changed.
|
WritableByteChannel |
A channel that can write bytes.
|
Class | Description |
---|---|
Channels |
Utility methods for channels and streams.
|
FileChannel |
A channel for reading, writing, mapping, and manipulating a file.
|
Exception | Description |
---|---|
AsynchronousCloseException |
Checked exception received by a thread when another thread closes the
channel or the part of the channel upon which it is blocked in an I/O
operation.
|
ClosedByInterruptException |
Checked exception received by a thread when another thread interrupts it
while it is blocked in an I/O operation upon a channel.
|
ClosedChannelException |
Checked exception thrown when an attempt is made to invoke or complete an
I/O operation upon channel that is closed, or at least closed to that
operation.
|
IllegalBlockingModeException |
Unchecked exception thrown when a blocking-mode-specific operation
is invoked upon a channel in the incorrect blocking mode.
|
NonReadableChannelException |
Unchecked exception thrown when an attempt is made to read
from a channel that was not originally opened for reading.
|
NonWritableChannelException |
Unchecked exception thrown when an attempt is made to write
to a channel that was not originally opened for writing.
|
Channels
Description
Channel
A nexus for I/O operations ReadableByteChannel
Can read into a buffer WritableByteChannel
Can write from a buffer ByteChannel
Can read/write to/from a buffer SeekableByteChannel
A ByteChannel
connected to an entity that contains a variable-length sequence of bytes
A channel represents an open connection to an entity such as a
hardware device, a file, a network socket, or a program component that is
capable of performing one or more distinct I/O operations, for example reading
or writing. As specified in the Channel
interface,
channels are either open or closed, and they are both asynchronously
closeable and interruptible.
The Channel
interface is extended by several
other interfaces.
The ReadableByteChannel
interface specifies a
read
method that reads bytes
from the channel into a buffer; similarly, the WritableByteChannel
interface specifies a write
method that writes bytes
from a buffer to the channel. The ByteChannel
interface unifies these two interfaces for the common case of channels that can
both read and write bytes. The SeekableByteChannel
interface extends the ByteChannel
interface with methods to query
and modify
the channel's
current position, and its size
.
The FileChannel
class supports the usual
operations of reading bytes from, and writing bytes to, a channel connected to
a file, as well as those of querying and modifying the current file position
and truncating the file to a specific size.
Finally, it defines
methods for forcing updates to the file to be written to the storage device that
contains it, for efficiently transferring bytes between the file and other
channels, and for mapping a region of the file directly into memory.
A FileChannel
is created by invoking one of its static open
methods to return a
file channel connected to the same underlying file as the java.io
class.
Unless otherwise noted, passing a null argument to a constructor
or method in any class or interface in this package will cause a NullPointerException
to be thrown.
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. Use of this specification is subject to license terms.