public class TypedArrays
extends java.lang.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 - ArrayBufferDataView instancepublic static DataView createDataView(ArrayBuffer buffer, int byteOffset)
buffer - ArrayBufferbyteOffset - 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 - ArrayBufferbyteOffset - 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 ArrayBufferFloat32Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferFloat32Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferFloat64Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferFloat64Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferInt16Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferInt16Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferInt32Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferInt32Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferInt8Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferInt8Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferUint16Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferUint16Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferUint32Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferUint32Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferUint8Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferUint8Array 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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 ArrayBufferUint8ClampedArray 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 ArrayBufferbyteOffset - byte offset from the start of bufferUint8ClampedArray 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 ArrayBufferbyteOffset - byte offset from the start of bufferlength - 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.