Script: Class Top Level DataView
Class DataView
- Object
- DataView
The DataView provides low level access to ArrayBuffer.
API Versioned:
From version 21.2.
Properties
buffer : ArrayBuffer
The array buffer referenced by this view.
byteLength : Number
The number of bytes in the array buffer used by this view.
byteOffset : Number
The start offset for this view within the array buffer.
Constructor Summary
DataView(buffer : ArrayBuffer, byteOffset : Number, byteLength : Number)
Creates a data view on the given ArrayBuffer.
Method Summary
getFloat32(byteOffset : Number, littleEndian : boolean) : Number
Returns the 32-bit floating point number at the given offset.
getFloat64(byteOffset : Number, littleEndian : boolean) : Number
Returns the 64-bit floating point number at the given offset.
getInt16(byteOffset : Number, littleEndian : boolean) : Number
Returns the 16-bit signed integer number at the given offset.
getInt32(byteOffset : Number, littleEndian : boolean) : Number
Returns the 32-bit signed integer number at the given offset.
getInt8(byteOffset : Number) : Number
Returns the 8-bit signed integer number at the given offset.
getUint16(byteOffset : Number, littleEndian : boolean) : Number
Returns the 16-bit unsigned integer number at the given offset.
getUint32(byteOffset : Number, littleEndian : boolean) : Number
Returns the 32-bit unsigned integer number at the given offset.
getUint8(byteOffset : Number) : Number
Returns the 8-bit unsigned integer number at the given offset.
setFloat32(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 32-bit floating point number into the byte array at the given offset.
setFloat64(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 64-bit floating point number into the byte array at the given offset.
setInt16(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 16-bit signed integer number into the byte array at the given offset.
setInt32(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 32-bit signed integer number into the byte array at the given offset.
setInt8(byteOffset : Number, value : Number) : void
Writes an 8-bit signed integer number into the byte array at the given offset.
setUint16(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 16-bit unsigned integer number into the byte array at the given offset.
setUint32(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 32-bit unsigned integer number into the byte array at the given offset.
setUint8(byteOffset : Number, value : Number) : void
Writes an 8-bit unsigned integer number into the byte array at the given offset.
Methods inherited from class Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Constructor Detail
DataView
publicDataView(buffer : ArrayBuffer, byteOffset : Number, byteLength : Number)
Creates a data view on the given ArrayBuffer.
Parameters:
buffer - The array buffer storage object.
byteOffset - Optional. The offset within the array buffer in bytes.
byteLength - Optional. The number of bytes visible to this view.
Method Detail
getFloat32
getFloat32(byteOffset : Number, littleEndian : boolean) : Number
Returns the 32-bit floating point number at the given offset.
Parameters:
byteOffset - The offset within the view.
littleEndian - Optional. Default is false. Use true if the number is stored in little-endian format.
getFloat64
getFloat64(byteOffset : Number, littleEndian : boolean) : Number
Returns the 64-bit floating point number at the given offset.
Parameters:
byteOffset - The offset within the view.
littleEndian - Optional. Default is false. Use true if the number is stored in little-endian format.
getInt16
getInt16(byteOffset : Number, littleEndian : boolean) : Number
Returns the 16-bit signed integer number at the given offset.
Parameters:
byteOffset - The offset within the view.
littleEndian - Optional. Default is false. Use true if the number is stored in little-endian format.
getInt32
getInt32(byteOffset : Number, littleEndian : boolean) : Number
Returns the 32-bit signed integer number at the given offset.
Parameters:
byteOffset - The offset within the view.
littleEndian - Optional. Default is false. Use true if the number is stored in little-endian format.
getInt8
getInt8(byteOffset : Number) : Number
Returns the 8-bit signed integer number at the given offset.
Parameters:
byteOffset - The offset within the view.
getUint16
getUint16(byteOffset : Number, littleEndian : boolean) : Number
Returns the 16-bit unsigned integer number at the given offset.
Parameters:
byteOffset - The offset within the view.
littleEndian - Optional. Default is false. Use true if the number is stored in little-endian format.
getUint32
getUint32(byteOffset : Number, littleEndian : boolean) : Number
Returns the 32-bit unsigned integer number at the given offset.
Parameters:
byteOffset - The offset within the view.
littleEndian - Optional. Default is false. Use true if the number is stored in little-endian format.
getUint8
getUint8(byteOffset : Number) : Number
Returns the 8-bit unsigned integer number at the given offset.
Parameters:
byteOffset - The offset within the view.
setFloat32
setFloat32(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 32-bit floating point number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.
littleEndian - Optional. Default is false. Use true if the little-endian format is to be used.
setFloat64
setFloat64(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 64-bit floating point number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.
littleEndian - Optional. Default is false. Use true if the little-endian format is to be used.
setInt16
setInt16(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 16-bit signed integer number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.
littleEndian - Optional. Default is false. Use true if the little-endian format is to be used.
setInt32
setInt32(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 32-bit signed integer number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.
littleEndian - Optional. Default is false. Use true if the little-endian format is to be used.
setInt8
setInt8(byteOffset : Number, value : Number) : void
Writes an 8-bit signed integer number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.
setUint16
setUint16(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 16-bit unsigned integer number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.
littleEndian - Optional. Default is false. Use true if the little-endian format is to be used.
setUint32
setUint32(byteOffset : Number, value : Number, littleEndian : boolean) : void
Writes a 32-bit unsigned integer number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.
littleEndian - Optional. Default is false. Use true if the little-endian format is to be used.
setUint8
setUint8(byteOffset : Number, value : Number) : void
Writes an 8-bit unsigned integer number into the byte array at the given offset.
Parameters:
byteOffset - The offset within the view.
value - The value to be written.