Reads bytes from the channel into the given buffer.
The maximum number of bytes that will be read is the
remaining() number of bytes in the buffer when the method
invoked. The bytes will be read into the buffer starting at the buffer's
position .
The call may block if other threads are also attempting to read on the
same channel.
Upon completion, the buffer's position() is updated to the
end of the bytes that were read. The buffer's limit() is
unmodified.
Parameters: buffer - the byte buffer to receive the bytes. the number of bytes actually read. throws: NonReadableChannelException - if the channel was not opened for reading. throws: ClosedChannelException - if the channel was already closed. throws: AsynchronousCloseException - if another thread closes the channel during the read. throws: ClosedByInterruptException - if another thread interrupt the calling thread during theread. throws: IOException - another IO exception occurs, details are in the message. |