[foreign-memaccess] RFR 8227394: Add MemorySegment::asByteBuffer convenience method

Jorn Vernee jbvernee at xs4all.nl
Thu Jul 11 11:28:51 UTC 2019


Hi,

Please review this small patch that adds an asByteBuffer convenience 
method to MemorySegment that returns a buffer the size of the segment.

Bug: https://bugs.openjdk.java.net/browse/JDK-8227394
Webrev: 
http://cr.openjdk.java.net/~jvernee/panama/webrevs/8227394/webrev.00/

(note that the javadoc is largely taken from 
MemoryAddress::asByteBuffer).

My reason for adding this is that I wanted to reach for this method a 
few times when playing with the API, but it didn't exist. So, I thought 
it would be useful to have.

(Also, I originally wanted to upload this to GitHub [1] to test out the 
Skara [2] tools, but apparently that's not operational yet :) )

Thanks,
Jorn

[1] : https://github.com/openjdk/panama/pull/1
[2] : https://github.com/openjdk/skara#openjdk-project-skara


More information about the panama-dev mailing list