RFR: 8369564: Provide a MemorySegment API to read strings with known lengths [v7]
Liam Miller-Cushon
cushon at openjdk.org
Fri Nov 21 14:34:55 UTC 2025
On Fri, 21 Nov 2025 14:26:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> We do not, thanks, fixed.
>>
>> Although I think the existing `allocateFrom(String, Charset)` method does have an undocumented dependency, because it uses `CharsetKind` to get the terminator char length, which only supports standard Charsets. If we add a fast path for UTF-16 that may need a dependency on a standard Charset (or a standard way to get the code unit size of a charset, if it has one).
>
> Note sure I follow -- the method you mention says this:
>
> * @throws IllegalArgumentException if {@code charset} is not a
> * {@linkplain StandardCharsets standard charset}
>
>
> What do you mean by "undocumented dependency"?
Sorry, you're right, it is documented. It's documented differently than e.g. `MemorySegment#getString`, which mentions it in both the `@param` and `@throws` doc.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2549946334
More information about the core-libs-dev
mailing list