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