abstract suspend fun read(dst: ByteBuffer): Int
(source)
Reads a sequence of bytes from this channel into the given buffer.
An attempt is made to read up to r bytes from the channel, where r is the number of bytes remaining in the buffer, that is, dst.remaining(), at the moment this method is invoked. If no bytes are available, then this method suspends until at least some bytes can be read.
dst
- The buffer into which bytes are to be transferred.
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.