Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286715

Generalize MemorySegment::ofBuffer

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 19
    • Component/s: core-libs
    • Labels:
      None
    • Resolved In Build:
      b24

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mcimadamore Maurizio Cimadamore
              Reporter:
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: