©2008 Google -
Code Home -
Site Terms of Service -
Privacy Policy -
Site Directory
Google Code offered in:
中文 -
English -
Português -
Pусский -
Español -
日本語
| java.nio.channels.ScatteringByteChannel | ReadableByteChannel |
The interface to channels that can read a set of buffers in a single operation.
The corresponding interface for writes is called
GatheringByteChannel.
Known Indirect Subclasses| long | read(ByteBuffer[] buffers, int offset, int length) | |||||
| Reads bytes from the channel into a subset of the given buffers. | ||||||
| long | read(ByteBuffer[] buffers) | |||||
| Reads bytes from the channel into all the given buffers. | ||||||
Methods inherited
from interface
java.io.Closeable
Methods inherited
from interface
java.nio.channels.Channel
Methods inherited
from interface
java.nio.channels.ReadableByteChannel
This method attempts to read all of the remaining() bytes
from length byte buffers, in order, starting at
buffers[offset]. The number of bytes actually read is
returned.
If a read operation is in progress, subsequent threads will block until the read is completed, and will then contend for the ability to read.
| buffers | the array of byte buffers into which the bytes will be read. |
|---|---|
| offset | the index of the first buffer to read. |
| length | the maximum number of buffers to read. |
| IndexOutOfBoundsException | if offset < 0 or > buffers.length; or length < 0 or > buffers.length - offset. |
|---|---|
| NonReadableChannelException | if the channel was not opened for reading. |
| ClosedChannelException | the channel is currently closed. |
| AsynchronousCloseException | the channel was closed by another thread while the write was underway. |
| ClosedByInterruptException | the thread was interrupted by another thread while the write was underway. |
| IOException | if some other type of exception occurs. Details are in the message. |
This method is equivalent to:
read(buffers, 0, buffers.length);
| buffers | the array of byte buffers to receive the bytes being read. |
|---|
| ClosedChannelException | if the channel is closed. |
|---|---|
| NonReadableChannelException | if the channel is open, but not in a mode that permits reading. |
| ClosedByInterruptException | if the thread is interrupted in its IO operation by another thread closing the channel. |
| AsynchronousCloseException | if the read is interrupted by another thread sending an explicit interrupt. |
| IOException | if some other type of exception occurs. Details are in the message. |