Relative bulk get method.
This method transfers bytes from this buffer into the given
destination array. If there are fewer bytes remaining in the
buffer than are required to satisfy the request, that is, if
length > remaining(), then no
bytes are transferred and a BufferUnderflowException is
thrown.
Otherwise, this method copies length bytes from this buffer into the given array, starting at the current position of this buffer and at the given offset in the array. The position of this buffer is then incremented by length.
In other words, an invocation of this method of the form src.get(dst, off, len) has exactly the same effect as the loop
for (int i = off; i < off + len; i++)
dst[i] = src.get():
except that it first checks that there are sufficient bytes in
this buffer and it is potentially much more efficient.
dst
| The array into which bytes are to be written | |
offset
| The offset within the array of the first byte to be written; must be non-negative and no larger than dst.length | |
length
| The maximum number of bytes to be written to the given array; must be non-negative and no larger than dst.length - offset |
BufferUnderflowException
| If there are fewer than length bytes remaining in this buffer | |
IndexOutOfBoundsException
| If the preconditions on the offset and length parameters do not hold |
Diagram: Buffer