On Fri, 21 Nov 2025 14:36:44 GMT, Liam Miller-Cushon <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/foreign/MemorySegment.java line 1333:
>> 
>>> 1331:      * sequences with this charset's default replacement string. The 
>>> {@link
>>> 1332:      * java.nio.charset.CharsetDecoder} class should be used when 
>>> more control
>>> 1333:      * over the decoding process is required.
>> 
>> Should we say here, as you did for `copy` that this method ignores `\0` ?
>
> I added:
> 
>> If the string contains any {@code '\0'} characters, they will be read as 
>> well.
> 
> I suppose it might also make sense to update those warnings in `setString` 
> and `allocateFrom` to mention that if you want to avoid truncating 
> null-terminated strings, `getString(long, Charset, long)` could be used 
> instead of `getString(long)`. What do you think?

Could be a good idea, thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2550485334

Reply via email to