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

Per Minborg pminborg at openjdk.org
Tue Aug 27 09:41:11 UTC 2024


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.

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

Commit messages:
 - Add copyright year
 - Add MemorySegment::getString overload

Changes: https://git.openjdk.org/jdk/pull/20725/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20725&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333843
  Stats: 132 lines in 4 files changed: 114 ins; 9 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/20725.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20725/head:pull/20725

PR: https://git.openjdk.org/jdk/pull/20725


More information about the core-libs-dev mailing list