JsBinaryData Class
Access to the bytes of the buffer sources (ArrayBuffer, SharedArrayBuffer, DataView and the typed arrays), without running JavaScript code.
public static class JsBinaryDataMethods
| Name | Description |
|---|---|
| DetachArrayBuffer(JsValue, JsValue) | Detaches an ArrayBuffer (DetachArrayBuffer(buffer, key)); the key is its [[ArrayBufferDetachKey]]. |
| GetSharedDataBlock(JsValue) | Gets the Shared Data Block of a SharedArrayBuffer, which JsRealm.CreateSharedArrayBuffer can share with a buffer of another engine (on another thread); null for the other values. |
| IsResizable(JsValue) | Gets whether a buffer source is backed by a resizable ArrayBuffer or a growable SharedArrayBuffer: the buffer itself, or the buffer that a typed array or a DataView views (IsFixedLengthArrayBuffer is false). Returns false for the other values. |
| SetArrayBufferMemory(JsValue, Memory<byte>) | Replaces the data block of an ArrayBuffer over external memory (JsRealm.CreateArrayBuffer or JsRealm.CreateResizableArrayBuffer): its byte length becomes the length of memory, which cannot exceed the maximum byte length of a resizable buffer. |
| TryGetBufferSource(JsValue, JsBufferKind, bool, Memory<byte>) | Gets the kind and the bytes of a buffer source. bytes is a view of the data block of the buffer (the writes are visible to JavaScript); it is empty when the buffer is detached or the view is out of bounds. Returns false for the other values. |
DetachArrayBuffer(JsValue, JsValue)
JsBinaryData.csDetaches an ArrayBuffer (DetachArrayBuffer(buffer, key)); the key is its [[ArrayBufferDetachKey]].
Parameters
Exceptions
ArgumentException- The value is not an ArrayBuffer.
JsException- The key is not the detach key of the buffer (a TypeError).
IsResizable(JsValue)
JsBinaryData.csGets whether a buffer source is backed by a resizable ArrayBuffer or a growable SharedArrayBuffer: the buffer itself, or the buffer that a typed array or a DataView views (IsFixedLengthArrayBuffer is false). Returns false for the other values.
SetArrayBufferMemory(JsValue, Memory<byte>)
JsBinaryData.csReplaces the data block of an ArrayBuffer over external memory (JsRealm.CreateArrayBuffer or JsRealm.CreateResizableArrayBuffer): its byte length becomes the length of memory, which cannot exceed the maximum byte length of a resizable buffer.
Parameters
arrayBufferJsValuememoryMemory<byte>
Exceptions
ArgumentException- The value is not an ArrayBuffer over external memory, or it is detached.
ArgumentOutOfRangeException- The memory is longer than the maximum byte length of the buffer.
TryGetBufferSource(JsValue, JsBufferKind, bool, Memory<byte>)
JsBinaryData.csGets the kind and the bytes of a buffer source. bytes is a view of the data block of the buffer (the writes are visible to JavaScript); it is empty when the buffer is detached or the view is out of bounds. Returns false for the other values.