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 <[email protected]> on behalf of Brian 
Burkhalter <[email protected]>
Sent: Wednesday, July 2, 2025 10:40 AM
To: Brett Okken <[email protected]>
Cc: core-libs-dev <[email protected]>
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 <[email protected]> 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