public class TypedArrays extends Object
isSupported()
returns false.
In client code, the various types are implemented by JavaScriptObjects, so you cannot reliable use instanceof checks on any of the returned implementations.
Modifier and Type | Class and Description |
---|---|
static class |
TypedArrays.Impl
Base class of implementations for creating various typed array structures.
|
Constructor and Description |
---|
TypedArrays() |
Modifier and Type | Method and Description |
---|---|
static ArrayBuffer |
createArrayBuffer(int length)
Create a new
ArrayBuffer of length bytes. |
static DataView |
createDataView(ArrayBuffer buffer)
Create a new
DataView instance on an ArrayBuffer . |
static DataView |
createDataView(ArrayBuffer buffer,
int byteOffset)
|
static DataView |
createDataView(ArrayBuffer buffer,
int byteOffset,
int byteLength)
Create a new
DataView instance on an ArrayBuffer , starting
at an offset of byteOffset and continuing for length
bytes. |
static Float32Array |
createFloat32Array(ArrayBuffer buffer)
Create a
Float32Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements). |
static Float32Array |
createFloat32Array(ArrayBuffer buffer,
int byteOffset)
Create a
Float32Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer
(which must be an integral number of elements). |
static Float32Array |
createFloat32Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Float32Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Float32Array |
createFloat32Array(int length)
|
static Float64Array |
createFloat64Array(ArrayBuffer buffer)
Create a
Float64Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements). |
static Float64Array |
createFloat64Array(ArrayBuffer buffer,
int byteOffset)
Create a
Float64Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer
(which must be an integral number of elements). |
static Float64Array |
createFloat64Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Float64Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Float64Array |
createFloat64Array(int length)
|
static Int16Array |
createInt16Array(ArrayBuffer buffer)
Create a
Int16Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements). |
static Int16Array |
createInt16Array(ArrayBuffer buffer,
int byteOffset)
Create a
Int16Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer
(which must be an integral number of elements). |
static Int16Array |
createInt16Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Int16Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Int16Array |
createInt16Array(int length)
|
static Int32Array |
createInt32Array(ArrayBuffer buffer)
Create a
Int32Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements). |
static Int32Array |
createInt32Array(ArrayBuffer buffer,
int byteOffset)
Create a
Int32Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer
(which must be an integral number of elements). |
static Int32Array |
createInt32Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Int32Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Int32Array |
createInt32Array(int length)
|
static Int8Array |
createInt8Array(ArrayBuffer buffer)
Create a
Int8Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end. |
static Int8Array |
createInt8Array(ArrayBuffer buffer,
int byteOffset)
Create a
Int8Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer
(which must be an integral number of elements). |
static Int8Array |
createInt8Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Int8Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Int8Array |
createInt8Array(int length)
|
static Uint16Array |
createUint16Array(ArrayBuffer buffer)
Create a
Uint16Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements). |
static Uint16Array |
createUint16Array(ArrayBuffer buffer,
int byteOffset)
Create a
Uint16Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer
(which must be an integral number of elements). |
static Uint16Array |
createUint16Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Uint16Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Uint16Array |
createUint16Array(int length)
|
static Uint32Array |
createUint32Array(ArrayBuffer buffer)
Create a
Uint32Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements). |
static Uint32Array |
createUint32Array(ArrayBuffer buffer,
int byteOffset)
Create a
Uint32Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer
(which must be an integral number of elements). |
static Uint32Array |
createUint32Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Uint32Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Uint32Array |
createUint32Array(int length)
|
static Uint8Array |
createUint8Array(ArrayBuffer buffer)
Create a
Uint8Array instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements). |
static Uint8Array |
createUint8Array(ArrayBuffer buffer,
int byteOffset)
Create a
Uint8Array instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer. |
static Uint8Array |
createUint8Array(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Uint8Array instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Uint8Array |
createUint8Array(int length)
|
static Uint8ClampedArray |
createUint8ClampedArray(ArrayBuffer buffer)
Create a
Uint8ClampedArray instance on buffer , starting at
starting at the beginning of the buffer and continuing to the end. |
static Uint8ClampedArray |
createUint8ClampedArray(ArrayBuffer buffer,
int byteOffset)
Create a
Uint8ClampedArray instance on buffer , starting at
byteOffset into the buffer, continuing to the end of the buffer. |
static Uint8ClampedArray |
createUint8ClampedArray(ArrayBuffer buffer,
int byteOffset,
int length)
Create a
Uint8ClampedArray instance on buffer , starting at
byteOffset into the buffer, continuing for length
elements. |
static Uint8ClampedArray |
createUint8ClampedArray(int length)
|
static boolean |
isSupported()
Check if the current environment supports typed arrays.
|
public static ArrayBuffer createArrayBuffer(int length)
ArrayBuffer
of length
bytes.length
- length of buffer in bytesArrayBuffer
instancepublic static DataView createDataView(ArrayBuffer buffer)
DataView
instance on an ArrayBuffer
.buffer
- ArrayBuffer
DataView
instancepublic static DataView createDataView(ArrayBuffer buffer, int byteOffset)
buffer
- ArrayBuffer
byteOffset
- offset into bufferDataView
instancepublic static DataView createDataView(ArrayBuffer buffer, int byteOffset, int byteLength)
DataView
instance on an ArrayBuffer
, starting
at an offset of byteOffset
and continuing for length
bytes.buffer
- ArrayBuffer
byteOffset
- offset into bufferbyteLength
- length of view in bytesDataView
instancepublic static Float32Array createFloat32Array(ArrayBuffer buffer)
Float32Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements).buffer
- underlying ArrayBuffer
Float32Array
instancepublic static Float32Array createFloat32Array(ArrayBuffer buffer, int byteOffset)
Float32Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer
(which must be an integral number of elements).buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Float32Array
instancepublic static Float32Array createFloat32Array(ArrayBuffer buffer, int byteOffset, int length)
Float32Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayFloat32Array
instancepublic static Float32Array createFloat32Array(int length)
length
- size of arrayFloat32Array
instancepublic static Float64Array createFloat64Array(ArrayBuffer buffer)
Float64Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements).
Note that Safari does not currently support Float64 Arrays!
buffer
- underlying ArrayBuffer
Float64Array
instancepublic static Float64Array createFloat64Array(ArrayBuffer buffer, int byteOffset)
Float64Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer
(which must be an integral number of elements).
Note that Safari does not currently support Float64 Arrays!
buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Float64Array
instancepublic static Float64Array createFloat64Array(ArrayBuffer buffer, int byteOffset, int length)
Float64Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.
Note that Safari does not currently support Float64 Arrays!
buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayFloat64Array
instancepublic static Float64Array createFloat64Array(int length)
Float64Array
instance of length
elements, backed
by a new ArrayBuffer
.
Note that Safari does not currently support Float64 Arrays!
length
- size of arrayFloat64Array
instancepublic static Int16Array createInt16Array(ArrayBuffer buffer)
Int16Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements).buffer
- underlying ArrayBuffer
Int16Array
instancepublic static Int16Array createInt16Array(ArrayBuffer buffer, int byteOffset)
Int16Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer
(which must be an integral number of elements).buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Int16Array
instancepublic static Int16Array createInt16Array(ArrayBuffer buffer, int byteOffset, int length)
Int16Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayInt16Array
instancepublic static Int16Array createInt16Array(int length)
length
- size of arrayInt16Array
instancepublic static Int32Array createInt32Array(ArrayBuffer buffer)
Int32Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements).buffer
- underlying ArrayBuffer
Int32Array
instancepublic static Int32Array createInt32Array(ArrayBuffer buffer, int byteOffset)
Int32Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer
(which must be an integral number of elements).buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Int32Array
instancepublic static Int32Array createInt32Array(ArrayBuffer buffer, int byteOffset, int length)
Int32Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayInt32Array
instancepublic static Int32Array createInt32Array(int length)
length
- size of arrayInt32Array
instancepublic static Int8Array createInt8Array(ArrayBuffer buffer)
Int8Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end.buffer
- underlying ArrayBuffer
Int8Array
instancepublic static Int8Array createInt8Array(ArrayBuffer buffer, int byteOffset)
Int8Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer
(which must be an integral number of elements).buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Int8Array
instancepublic static Int8Array createInt8Array(ArrayBuffer buffer, int byteOffset, int length)
Int8Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayInt8Array
instancepublic static Int8Array createInt8Array(int length)
length
- size of arrayInt8Array
instancepublic static Uint16Array createUint16Array(ArrayBuffer buffer)
Uint16Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements).buffer
- underlying ArrayBuffer
Uint16Array
instancepublic static Uint16Array createUint16Array(ArrayBuffer buffer, int byteOffset)
Uint16Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer
(which must be an integral number of elements).buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Uint16Array
instancepublic static Uint16Array createUint16Array(ArrayBuffer buffer, int byteOffset, int length)
Uint16Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayUint16Array
instancepublic static Uint16Array createUint16Array(int length)
length
- size of arrayUint16Array
instancepublic static Uint32Array createUint32Array(ArrayBuffer buffer)
Uint32Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements).buffer
- underlying ArrayBuffer
Uint32Array
instancepublic static Uint32Array createUint32Array(ArrayBuffer buffer, int byteOffset)
Uint32Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer
(which must be an integral number of elements).buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Uint32Array
instancepublic static Uint32Array createUint32Array(ArrayBuffer buffer, int byteOffset, int length)
Uint32Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayUint32Array
instancepublic static Uint32Array createUint32Array(int length)
length
- size of arrayUint32Array
instancepublic static Uint8Array createUint8Array(ArrayBuffer buffer)
Uint8Array
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end (which
must be an integral number of elements).buffer
- underlying ArrayBuffer
Uint8Array
instancepublic static Uint8Array createUint8Array(ArrayBuffer buffer, int byteOffset)
Uint8Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Uint8Array
instancepublic static Uint8Array createUint8Array(ArrayBuffer buffer, int byteOffset, int length)
Uint8Array
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayUint8Array
instancepublic static Uint8Array createUint8Array(int length)
length
- size of arrayUint8Array
instancepublic static Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer)
Uint8ClampedArray
instance on buffer
, starting at
starting at the beginning of the buffer and continuing to the end.buffer
- underlying ArrayBuffer
Uint8ClampedArray
instancepublic static Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer, int byteOffset)
Uint8ClampedArray
instance on buffer
, starting at
byteOffset
into the buffer, continuing to the end of the buffer.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
Uint8ClampedArray
instancepublic static Uint8ClampedArray createUint8ClampedArray(ArrayBuffer buffer, int byteOffset, int length)
Uint8ClampedArray
instance on buffer
, starting at
byteOffset
into the buffer, continuing for length
elements.buffer
- underlying ArrayBuffer
byteOffset
- byte offset from the start of buffer
length
- number of elements in the resulting arrayUint8ClampedArray
instancepublic static Uint8ClampedArray createUint8ClampedArray(int length)
length
- size of arrayUint8ClampedArray
instancepublic static boolean isSupported()
createXXX
methods is undefined if this method returns
false
, but will typically throw some exception.Copyright © 2018. All rights reserved.