I think Brett is right. The spec of CharBuffer says:

The methods defined by {@code CharSequence} operate relative to the current
position of the buffer when they are invoked.

Yet getChars is an absolute bulk get method.

Since JDK25 is still in RDP, we still have a chance to fix this up.
________________________________
From: core-libs-dev <core-libs-dev-r...@openjdk.org> on behalf of Brian 
Burkhalter <brian.burkhal...@oracle.com>
Sent: Wednesday, July 2, 2025 10:40 AM
To: Brett Okken <brett.okken...@gmail.com>
Cc: core-libs-dev <core-libs-dev@openjdk.org>
Subject: Re: StringCharBuffer and bulk get

Some methods are absolute and some relative:

https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/nio/Buffer.html#transferring-data-heading

On Jul 2, 2025, at 8:35 AM, Brett Okken <brett.okken...@gmail.com> wrote:

CharBuffer implementation of public default void getChars(int
srcBegin, int srcEnd, char[] dst, int dstBegin) uses absolute
positioning for the indexes (i.e. ignores the current position).

Reply via email to