DataView

extern class js.html.DataViewextends ArrayBufferViewAvailable in js
DRAFT
This page is not complete.
Note: 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.
function new( ?arg0 : Dynamic, ?arg1 : Dynamic, ?arg2 : Dynamic ) : VoidDataView 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 new DataView 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
INDEX_SIZE_ERR
The byteOffset and byteLength result in the specified view extending past the end of the buffer.
function getFloat32( byteOffset : Int, ?littleEndian : Bool ) : Float function getFloat64( byteOffset : Int, ?littleEndian : Bool ) : Float function getInt16( byteOffset : Int, ?littleEndian : Bool ) : Int function getInt32( byteOffset : Int, ?littleEndian : Bool ) : Int 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
Throws DOMException.
function getUint16( byteOffset : Int, ?littleEndian : Bool ) : Int function getUint32( byteOffset : Int, ?littleEndian : Bool ) : Int 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
Throws DOMException.
function setFloat32( byteOffset : Int, value : Float, ?littleEndian : Bool ) : Void function setFloat64( byteOffset : Int, value : Float, ?littleEndian : Bool ) : Void function setInt16( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void function setInt32( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void function setInt8( byteOffset : Int, value : Int ) : VoidThrows DOMException. function setUint16( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void function setUint32( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void function setUint8( byteOffset : Int, value : Int ) : VoidThrows DOMException.
version #19195, modified 2013-05-08 11:06:28 by api
0 comment