JDK-8219014 : (bf) Add absolute bulk put methods which accept a source Buffer
Type:Enhancement
Component:core-libs
Sub-Component:java.nio
Affected Version:13
Priority:P4
Status:Resolved
Resolution:Fixed
Submitted:2019-02-14
Updated:2020-12-16
Resolved:2020-11-05
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
Potential specification:
/**
* Absolute bulk <i>put</i> method <i>(optional operation)</i>.
*
* <p> This method transfers {@code length} $type$s into this buffer
* from the source buffer, starting at the given {@code srcIndex} in the
* source buffer and the given {@code index} in this buffer. The positions
* of both buffers are unchanged. The source buffer may be this buffer and
* the specified regions may overlap.
*
* <p> An invocation of this method of the form
* <code>dst.put(index, src, srcIndex, length)</code>
* has exactly the same effect as the following loop except that it first
* checks the consistency of the supplied parameters and it is potentially
* much more efficient:
*
* <pre>{@code
* for (int i = srcIndex, j = index; i < srcIndex + length; i++, j++)
* dst.put(j, src.get(i));
* }</pre>
*
* @param index
* The index in this buffer at which the first $type$ will be
* written; must be non-negative and less than {@code limit()}
*
* @param src
* The buffer from which $type$s are to be read
*
* @param srcIndex
* The index within the source buffer of the first $type$ to be
* read; must be non-negative and less than {@code src.limit()}
*
* @param length
* The number of $type$s to be read from the given buffer;
* must be non-negative and no larger than the smaller of
* {@code limit() - index} and {@code src.limit() - offset}
*
* @return This buffer
*
* @throws IndexOutOfBoundsException
* If the preconditions on the {@code index}, {@code srcIndex}, and
* {@code length}, parameters do not hold
*
* @throws ReadOnlyBufferException
* If this buffer is read-only
*
* @since tbd
*/
public $Type$Buffer put(int index, $Type$Buffer src, int srcIndex, int length) {}