MemorySegment::ofBuffer can be used to create a memory segment out of a byte buffer. It could be sometimes useful to create a memory segment out of other kinds of buffer instances, e.g. an IntBuffer. This can be done by altering the parameter of the ofBuffer factory, from ByteBuffer to just Buffer.
For the reverse direction (segment to buffer) we have two options:
* just leave `asByteBuffer`. Users can generally convert a byte buffer into other buffer views using the `asXYZBuffer` methods.
* add overloads for different buffer kinds, accepting different value layouts.
For the reverse direction (segment to buffer) we have two options:
* just leave `asByteBuffer`. Users can generally convert a byte buffer into other buffer views using the `asXYZBuffer` methods.
* add overloads for different buffer kinds, accepting different value layouts.
- csr for
-
JDK-8286743 Generalize MemorySegment::ofBuffer
- Closed