ArrayBuffer class
class ArrayBuffer extends ChromeObject { static ArrayBuffer create(JsObject jsProxy) => new ArrayBuffer.fromProxy(jsProxy); ArrayBuffer(); ArrayBuffer.fromProxy(/*JsObject*/ jsProxy): super.fromProxy(jsProxy); factory ArrayBuffer.fromBytes(List<int> data) { var uint8Array = new JsObject(context['Uint8Array'], [new JsObject.jsify(data)]); return new ArrayBuffer.fromProxy(uint8Array['buffer']); } factory ArrayBuffer.fromString(String str) { var uint8Array = new JsObject(context['Uint8Array'], [new JsObject.jsify(str.codeUnits)]); return new ArrayBuffer.fromProxy(uint8Array['buffer']); } List<int> getBytes() { var int8View = new JsObject(context['Uint8Array'], [jsProxy]); List<int> result = new List<int>(int8View['length']); // TODO: this is _very_ slow // can we instead do: jsArray = Array.apply([], int8View); for (int i = 0; i < result.length; i++) { result[i] = int8View[i]; } return result; } }
Extends
ChromeObject > ArrayBuffer
Static Methods
ArrayBuffer create(JsObject jsProxy) #
static ArrayBuffer create(JsObject jsProxy) => new ArrayBuffer.fromProxy(jsProxy);
Constructors
new ArrayBuffer() #
Create a new instance of a ChromeObject
, which creates and delegates to
a JsObject proxy.
docs inherited from ChromeObject
ArrayBuffer();
factory ArrayBuffer.fromBytes(List<int> data) #
factory ArrayBuffer.fromBytes(List<int> data) { var uint8Array = new JsObject(context['Uint8Array'], [new JsObject.jsify(data)]); return new ArrayBuffer.fromProxy(uint8Array['buffer']); }
new ArrayBuffer.fromProxy(jsProxy) #
Create a new instance of a ChromeObject
, which delegates to the given
JsObject proxy.
docs inherited from ChromeObject
ArrayBuffer.fromProxy(/*JsObject*/ jsProxy): super.fromProxy(jsProxy);
factory ArrayBuffer.fromString(String str) #
factory ArrayBuffer.fromString(String str) { var uint8Array = new JsObject(context['Uint8Array'], [new JsObject.jsify(str.codeUnits)]); return new ArrayBuffer.fromProxy(uint8Array['buffer']); }
Properties
Methods
List<int> getBytes() #
List<int> getBytes() { var int8View = new JsObject(context['Uint8Array'], [jsProxy]); List<int> result = new List<int>(int8View['length']); // TODO: this is _very_ slow // can we instead do: jsArray = Array.apply([], int8View); for (int i = 0; i < result.length; i++) { result[i] = int8View[i]; } return result; }
String toString() #
inherited from ChromeObject
Returns a string representation of this object.
docs inherited from Object
String toString() => jsProxy.toString();