stealify / graalvm-nodejs-context

A Collection of usefull Objects and Methods that would exist by default inside nodejs used to run NodeJS Code inside of GraalVM's ECMAScript Context
Apache License 2.0
0 stars 0 forks source link

ArrayByte Buffer #8

Open frank-dspeed opened 3 years ago

frank-dspeed commented 3 years ago
const ByteBuffer = Java.type('java.nio.ByteBuffer');

class createByteBuffer extends ArrayBuffer {
  constructor(...args) {
    super(...args);
    if (args[0] && Java.isJavaObject(args[0]) && args[0] instanceof ByteBuffer) {
      Object.defineProperty(this, "__jbuffer", {
        value: args[0]
      });
    }
  }
}

globalThis.ArrayBuffer = createByteBuffer;
frank-dspeed commented 3 years ago

from https://github.com/direktspeed/jnjs