public V8ArrayBuffer(final V8 v8, ByteBuffer byteBuffer) { super(v8); if (byteBuffer == null) { byteBuffer = ByteBuffer.allocateDirect(0); } if (!byteBuffer.isDirect()) { throw new IllegalArgumentException("ByteBuffer must be a allocated as a direct ByteBuffer"); } initialize(v8.getV8RuntimePtr(), byteBuffer); this.byteBuffer = byteBuffer; byteBuffer.order(ByteOrder.nativeOrder()); }
/** * Creates a new V8ArrayBuffer on a given V8Runtime with a * given capacity. * * @param v8 The runtime on which to create the ArrayBuffer * @param capacity The capacity of the buffer */ public V8ArrayBuffer(final V8 v8, final int capacity) { super(v8); initialize(v8.getV8RuntimePtr(), capacity); byteBuffer = v8.createV8ArrayBufferBackingStore(v8.getV8RuntimePtr(), objectHandle, capacity); byteBuffer.order(ByteOrder.nativeOrder()); }
public V8ArrayBuffer(final V8 v8, ByteBuffer byteBuffer) { super(v8); if (byteBuffer == null) { byteBuffer = ByteBuffer.allocateDirect(0); } if (!byteBuffer.isDirect()) { throw new IllegalArgumentException("ByteBuffer must be a allocated as a direct ByteBuffer"); } initialize(v8.getV8RuntimePtr(), byteBuffer); this.byteBuffer = byteBuffer; byteBuffer.order(ByteOrder.nativeOrder()); }
/** * Creates a new V8ArrayBuffer on a given V8Runtime with a * given capacity. * * @param v8 The runtime on which to create the ArrayBuffer * @param capacity The capacity of the buffer */ public V8ArrayBuffer(final V8 v8, final int capacity) { super(v8); initialize(v8.getV8RuntimePtr(), capacity); byteBuffer = v8.createV8ArrayBufferBackingStore(v8.getV8RuntimePtr(), objectHandle, capacity); byteBuffer.order(ByteOrder.nativeOrder()); }
/** * Creates a new V8ArrayBuffer with the provided ByteBuffer as the backing store. * The ByteBuffer must be allocated as a DirectBuffer. If the ByteBuffer is not * a DirectBuffer an IllegalArgumentException will be thrown. * * @param v8 The runtime on which to create the ArrayBuffer * @param byteBuffer The ByteBuffer to use as the backing store. The ByteBuffer must * be allocated as a DirectBuffer. */ public V8ArrayBuffer(final V8 v8, final ByteBuffer byteBuffer) { super(v8); if (!byteBuffer.isDirect()) { throw new IllegalArgumentException("ByteBuffer must be a allocated as a direct ByteBuffer"); } initialize(v8.getV8RuntimePtr(), byteBuffer); this.byteBuffer = byteBuffer; byteBuffer.order(ByteOrder.nativeOrder()); }
/** * Creates a new V8ArrayBuffer with the provided ByteBuffer as the backing store. * The ByteBuffer must be allocated as a DirectBuffer. If the ByteBuffer is not * a DirectBuffer an IllegalArgumentException will be thrown. * * @param v8 The runtime on which to create the ArrayBuffer * @param byteBuffer The ByteBuffer to use as the backing store. The ByteBuffer must * be allocated as a DirectBuffer. */ public V8ArrayBuffer(final V8 v8, final ByteBuffer byteBuffer) { super(v8); if (!byteBuffer.isDirect()) { throw new IllegalArgumentException("ByteBuffer must be a allocated as a direct ByteBuffer"); } initialize(v8.getV8RuntimePtr(), byteBuffer); this.byteBuffer = byteBuffer; byteBuffer.order(ByteOrder.nativeOrder()); }
/** * Creates a new V8ArrayBuffer on a given V8Runtime with a * given capacity. * * @param v8 The runtime on which to create the ArrayBuffer * @param capacity The capacity of the buffer */ public V8ArrayBuffer(final V8 v8, final int capacity) { super(v8); initialize(v8.getV8RuntimePtr(), capacity); byteBuffer = v8.createV8ArrayBufferBackingStore(v8.getV8RuntimePtr(), objectHandle, capacity); byteBuffer.order(ByteOrder.nativeOrder()); }
/** * Creates a new V8ArrayBuffer on a given V8Runtime with a * given capacity. * * @param v8 The runtime on which to create the ArrayBuffer * @param capacity The capacity of the buffer */ public V8ArrayBuffer(final V8 v8, final int capacity) { super(v8); initialize(v8.getV8RuntimePtr(), capacity); byteBuffer = v8.createV8ArrayBufferBackingStore(v8.getV8RuntimePtr(), objectHandle, capacity); byteBuffer.order(ByteOrder.nativeOrder()); }