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

need ArrayBuffer constructor with specified data

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b67
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        need a way to create an ArrayBuffer initialized with given byte array data. Perhaps a constructor that takes an array of bytes or a [Direct]ByteBuffer as an arg to use as the initial bytes for the array -

          ArrayBuffer(byte[] data);
          ArrayBuffer(java.nio.ByteBuffer data);

        We could also add one that specifies offset and length for convenience -

          ArrayBuffer(byte[] data, int offset, int length);
          ArrayBuffer(java.nio.ByteBuffer data, int offset, int length);

        V8 provides a similar API -

          static Local<ArrayBuffer> ArrayBuffer::New(void* data, size_t byte_length);

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sundar Sundararajan Athijegannathan
                  Reporter:
                  akhil Akhil Arora (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: