RFR: 8333843: Provide methods on MemorySegment to read strings with known lengths [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Sep 12 13:48:08 UTC 2024


On Thu, 12 Sep 2024 13:44:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg 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 10 additional commits since the last revision:
>> 
>>  - Remove trailing blanks
>>  - Add back extra line break
>>  - Add copyright year
>>  - Update copyright year
>>  - Revoke change to copyright year
>>  - Reinstate code
>>  - Move logic to doc
>>  - Merge branch 'master' into ms-string-known-length
>>  - Add copyright year
>>  - Add MemorySegment::getString overload
>
> src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1288:
> 
>> 1286:      * over the decoding process is required.
>> 1287:      * <p>
>> 1288:      * Getting a String from a {@code segment} with a known byte {@code offset} and
> 
> Suggestion:
> 
>      * Getting a string from a {@code segment} with a known byte {@code offset} and

I would drop all the `{@code ... }` here. E.g. 

Getting a string from a segment with known byte offset and byte length can be done like so:

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20725#discussion_r1756907925


More information about the core-libs-dev mailing list