class js.html.DataView extends ArrayBufferView
Available on js
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
.
Documentation for this class was provided by MDN.
Instance Fields
function new(?arg0:Dynamic, ?arg1:Dynamic, ?arg2:Dynamic):Void
DataView DataView(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength);
Returns a new DataView
object using the passed ArrayBuffer for its storage.
DataView DataView( ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long byteLength );
Parameters
buffer
- An existing
ArrayBuffer
to use as the storage for the newDataView
object. byteOffset
Optional- The offset, in bytes, to the first byte in the specified buffer for the new view to reference. If not specified, the view of the buffer will start with the first byte.
byteLength
Optional- The number of elements in the byte array. If unspecified, length of the view will match the buffer's length.
Return value
A new DataView
object representing the specified data buffer.
Exceptions thrown
INDEXSIZEERR
- The
byteOffset
andbyteLength
result in the specified view extending past the end of the buffer.
function getInt8(byteOffset:Int):Int
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
function getUint8(byteOffset:Int):Int
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