On Thu, 12 Sep 2024 12:44:41 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> This PR proposes to add a new overload to `MemorySegment::getString` whereby >> it is possible to pass in a known byte length of the content in a segment >> that should be converted to a String. This is useful in case one already >> knows the byte length and thereby does not need to scan for a null >> terminator. > > 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 1290: > 1288: * Getting a String from a {@code segment} with a known byte {@code > offset} and > 1289: * known byte {@code length} can be done like so: > 1290: * {@snippet lang=java A semicolon at the end of the line is missing - this is causing build issues in the github action: /home/runner/work/jdk/jdk/src/java.base/share/classes/java/lang/foreign/MemorySegment.java:1291: error: unexpected content * byte[] bytes = new byte[length]; ^ ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20725#discussion_r1758521557