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

need ArrayBuffer constructor with specified data

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • core-libs
    • None
    • b67
    • generic
    • generic

        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);

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

                Created:
                Updated:
                Resolved: