5071718: (bf) Add ByteBuffer.slice(int offset, int length)

Brent Christian brent.christian at oracle.com
Tue Feb 26 00:30:18 UTC 2019

A nit for the new javadoc:

I find it a little weird for one paragraph to start, "The new buffer 
will start at position {@code index}...", and the next paragraph to 
start, "The new buffer's position will be zero."

I find the no-arg slice()'s reference to "the content of the new buffer" 
to be a bit clearer.  So my suggestion would be, e.g.:

"The content of the new buffer will start at position {@code index} in 
this buffer, and will contain {@code length} elements."


On 2/25/19 1:41 PM, Brian Burkhalter wrote:
> Updated [1] to allow for the case ‘slice(limit(),0)' with no IOOBE and to add ‘slice(int,int)’ to the “additional operations” section of the Buffer class-level specification.
> The CSR [2] description has also been updated but not the specdiff attachment: will hold off on that until the verbiage is agreed upon.
> Thanks,
> Brian
> [1] http://cr.openjdk.java.net/~bpb/5071718/webrev.01/
> [2] https://bugs.openjdk.java.net/browse/JDK-8219608

More information about the nio-dev mailing list