RFR: 4860681: (bf) Add CharBuffer absolute bulk put method for CharSequence [v5]

Brian Burkhalter bpb at openjdk.org
Mon Oct 9 21:19:44 UTC 2023


On Mon, 9 Oct 2023 20:31:41 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>> 
>>  - Merge
>>  - 4860681: Heap and direct buffer specializations
>>  - 4860681: Change some {@code ...} to <code>...</code> to prevent line breaking
>>  - 4860681: Modify existing test
>>  - Merge
>>  - 4860681: Add spaces to parameter lists in @see tag
>>  - 4860681: (bf) Add CharBuffer absolute bulk put method for CharSequence
>
> src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 542:
> 
>> 540:                     sb.getChars(start, start + count, buf, 0);
>> 541:                 } else if (csq instanceof StringBuffer sb) {
>> 542:                     sb.getChars(start, start + count, buf, 0);
> 
> Can the allocation and double copy be avoided?
> But I guess the combinatorics of latin1/utf16 string encoding and the memory and byte order make it difficult.

Back when I was originally developing this change I could not see any better way to do this part.

> test/jdk/java/nio/Buffer/Basic-X.java.template line 636:
> 
>> 634:         long seed = System.nanoTime();
>> 635:         Random rnd = new Random(seed);
>> 636: 
> 
> Printing the seed would make it possible to repeat the same test.

So modified in 2ea96eed0bba75e1126ede5de31ebbb05950d663.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13744#discussion_r1350793218
PR Review Comment: https://git.openjdk.org/jdk/pull/13744#discussion_r1350792811


More information about the nio-dev mailing list