Question about Linker.Option.isTrivial()

Pedro Lamarão pedro.lamarao at prodist.com.br
Mon Jan 15 14:13:08 UTC 2024


Em seg., 15 de jan. de 2024 às 09:57, 刘希晨 <benrush0705 at gmail.com> escreveu:


> I think it's a really common behaviour in network programming, like
> ByteBuffer, recording the current message offset as its instance variable,
> so the caller could use get() method multiple times without worrying about
> its current offset, currently I wrapped MemorySegment in a ByteBuffer-like
> structure for content reading and writing, but with
> MemorySegment.getString() and MemorySegment.setString(), the afterwards
> offset can't be obtained.
>

In my experience, network protocols will encode variable length data with a
length prefix, so that you already know how many bytes are there before
decoding. The alternative, to encode the variable length data with a
sentinel value, is uncommon.

-- 
Pedro Lamarão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/panama-dev/attachments/20240115/c0a42960/attachment.htm>


More information about the panama-dev mailing list