As for the refinements mentioned in JEP454
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Jun 11 13:51:54 UTC 2024
See the "throws" section of the javadoc:
|IllegalArgumentException
<https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/IllegalArgumentException.html>|
- if |charset| is not a standard charset
<https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/charset/StandardCharsets.html>
We only support common fixed-size charsets, as being fixed-size allows
us to determine string length and also how many terminator bytes to add.
Maurizio
On 11/06/2024 14:05, Jonathan Rosenne wrote:
>
> Hi,
>
> regarding (3), the link just says Charset, not StandardCharset. Please
> clarify.
>
> Jonathan
>
> *From:*panama-dev <panama-dev-retn at openjdk.org> *On Behalf Of
> *Maurizio Cimadamore
> *Sent:* Monday, June 10, 2024 12:46 PM
> *To:* Cheng Jin <jincheng at ca.ibm.com>; panama-dev at openjdk.org
> *Subject:* Re: As for the refinements mentioned in JEP454
>
> Hi, some answers below:
>
> (1) refers to the ability to query what primitive layouts are like,
> using Linker::canonicalLayouts.
> See:
> https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/Linker.html#canonicalLayouts()
>
> (2) refers to the new methods in MemoryLayout, namely
> MemoryLayout::scale/scaleHandle, together with the fact that now all
> var handles generated by this API take a start offset (so they are
> easier to combine).
> see:
> https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/Linker.html#canonicalLayouts()
>
> (3) refers to the fact that you can now read and write strings with
> more charsets than just UTF8. You can now use any charset in
> StandardCharsets (to which we have added UTF32, for good measure).
> see:
> https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/MemorySegment.html#getString(long,java.nio.charset.Charset)
>
> Maurizio
>
> On 07/06/2024 23:30, Cheng Jin wrote:
>
> Hi there,
>
> I’ve got a question about JEP454 at https://openjdk.org/jeps/454
> in which some of refinements confused me as follows:
>
> 1. /Enabled clients to build C-language function descriptors
> programmatically, avoiding platform-specific constants;/
> 2. /Improved support for variable-length arrays in native memory;/
> 3. /Added support for arbitrary charsets for native strings./
>
> I didn’t find any description in the JEP to clarify how they work
> and what they mean to users.
>
> Could anybody explain these refinements in more details? Many thanks.
>
> Best Regards
>
> Cheng
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240611/08cca362/attachment-0001.htm>
More information about the panama-dev
mailing list