abstract fun tryRead(dsts: Array<ByteBuffer>, offset: Int = 0, length: Int = dsts.size): Long
(source)
Reads a sequence of bytes from this channel into a subsequence of the given buffers, if any are available.
dsts
- The buffers into which bytes are to be transferred.
offset
- The offset within the buffer array of the first buffer into which bytes are to be transferred;
must be non-negative and no larger than dsts.length
.
length
- The maximum number of buffers to be accessed; must be non-negative and no larger than
dsts.length - offset
.
IndexOutOfBoundsException
- If the preconditions on the offset and length parameters do not hold.
NonReadableChannelException
- If this channel was not opened for reading.
ClosedChannelException
- If the channel is closed.
AsynchronousCloseException
- If another thread closes this channel while the read operation is in progress.
ClosedByInterruptException
- If another thread interrupts the current thread while the read operation is
in progress, thereby closing the channel and setting the current thread's interrupt status.
IOException
- If some other I/O error occurs.
Return
The number of bytes read, possibly zero, or -1
if the channel has reached end-of-stream.