|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ScatteringByteChannel
The interface to channels that can read a set of buffers in a single operation.
The corresponding interface for writes is called
GatheringByteChannel.
| Method Summary | |
|---|---|
long |
read(ByteBuffer[] buffers)
Reads bytes from the channel into all the given buffers. |
long |
read(ByteBuffer[] buffers,
int offset,
int length)
Reads bytes from the channel into a subset of the given buffers. |
| Methods inherited from interface java.nio.channels.ReadableByteChannel |
|---|
read |
| Methods inherited from interface java.nio.channels.Channel |
|---|
close, isOpen |
| Method Detail |
|---|
long read(ByteBuffer[] buffers)
throws IOException
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.
long read(ByteBuffer[] buffers,
int offset,
int length)
throws IOException
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.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||