DataView Interface
DataView
is not yet implemented in Gecko. It is implemented in Chrome 9.An ArrayBuffer
is a useful object for representing an arbitrary chunk of data. In many cases, such data will be read from disk or from the network, and will not follow the alignment restrictions that are imposed on the Typed Array Views described earlier. In addition, the data will often be heterogeneous in nature and have a defined byte order.
The DataView
view provides a low-level interface for reading such data from and writing it to an ArrayBuffer
.
Extends
Constructors
Code new DataView(ArrayBuffer buffer, [int byteOffset, int byteLength]) #
DataView(ArrayBuffer buffer, [int byteOffset, int byteLength]);
Methods
Code num getFloat32(int byteOffset, [bool littleEndian]) #
num getFloat32(int byteOffset, [bool littleEndian]);
Code num getFloat64(int byteOffset, [bool littleEndian]) #
num getFloat64(int byteOffset, [bool littleEndian]);
Code int getInt16(int byteOffset, [bool littleEndian]) #
int getInt16(int byteOffset, [bool littleEndian]);
Code int getInt32(int byteOffset, [bool littleEndian]) #
int getInt32(int byteOffset, [bool littleEndian]);
Code int getInt8(int byteOffset) #
Gets a signed 8-bit integer at the specified byte offset from the start of the view.
Parameters
offset
- The offset, in byte, from the start of the view where to read the data.
Exceptions thrown
INDEX_SIZE_ERR
- The
byteOffset
is set such as it would read beyond the end of the view
int getInt8(int byteOffset);
Code int getUint16(int byteOffset, [bool littleEndian]) #
int getUint16(int byteOffset, [bool littleEndian]);
Code int getUint32(int byteOffset, [bool littleEndian]) #
int getUint32(int byteOffset, [bool littleEndian]);
Code int getUint8(int byteOffset) #
Gets an unsigned 8-bit integer at the specified byte offset from the start of the view.
Parameters
offset
- The offset, in byte, from the start of the view where to read the data.
INDEX_SIZE_ERR
- The
byteOffset
is set such as it would read beyond the end of the view
int getUint8(int byteOffset);
Code void setFloat32(int byteOffset, num value, [bool littleEndian]) #
void setFloat32(int byteOffset, num value, [bool littleEndian]);
Code void setFloat64(int byteOffset, num value, [bool littleEndian]) #
void setFloat64(int byteOffset, num value, [bool littleEndian]);
Code void setInt16(int byteOffset, int value, [bool littleEndian]) #
void setInt16(int byteOffset, int value, [bool littleEndian]);
Code void setInt32(int byteOffset, int value, [bool littleEndian]) #
void setInt32(int byteOffset, int value, [bool littleEndian]);
Code void setUint16(int byteOffset, int value, [bool littleEndian]) #
void setUint16(int byteOffset, int value, [bool littleEndian]);
Code void setUint32(int byteOffset, int value, [bool littleEndian]) #
void setUint32(int byteOffset, int value, [bool littleEndian]);
This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.