Class TypedArrays
java.lang.Object
com.google.gwt.typedarrays.shared.TypedArrays
Factory class for various typed arrays. Behavior of all other methods is
undefined if
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Base class of implementations for creating various typed array structures. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayBuffer
createArrayBuffer
(int length) Create a newArrayBuffer
oflength
bytes.static DataView
createDataView
(ArrayBuffer buffer) Create a newDataView
instance on anArrayBuffer
.static DataView
createDataView
(ArrayBuffer buffer, int byteOffset) static DataView
createDataView
(ArrayBuffer buffer, int byteOffset, int byteLength) Create a newDataView
instance on anArrayBuffer
, starting at an offset ofbyteOffset
and continuing forlength
bytes.static Float32Array
createFloat32Array
(int length) static Float32Array
createFloat32Array
(ArrayBuffer buffer) Create aFloat32Array
instance onbuffer
, 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 aFloat32Array
instance onbuffer
, starting atbyteOffset
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 aFloat32Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Float64Array
createFloat64Array
(int length) static Float64Array
createFloat64Array
(ArrayBuffer buffer) Create aFloat64Array
instance onbuffer
, 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 aFloat64Array
instance onbuffer
, starting atbyteOffset
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 aFloat64Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Int16Array
createInt16Array
(int length) static Int16Array
createInt16Array
(ArrayBuffer buffer) Create aInt16Array
instance onbuffer
, 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 aInt16Array
instance onbuffer
, starting atbyteOffset
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 aInt16Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Int32Array
createInt32Array
(int length) static Int32Array
createInt32Array
(ArrayBuffer buffer) Create aInt32Array
instance onbuffer
, 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 aInt32Array
instance onbuffer
, starting atbyteOffset
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 aInt32Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Int8Array
createInt8Array
(int length) static Int8Array
createInt8Array
(ArrayBuffer buffer) Create aInt8Array
instance onbuffer
, starting at starting at the beginning of the buffer and continuing to the end.static Int8Array
createInt8Array
(ArrayBuffer buffer, int byteOffset) Create aInt8Array
instance onbuffer
, starting atbyteOffset
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 aInt8Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Uint16Array
createUint16Array
(int length) static Uint16Array
createUint16Array
(ArrayBuffer buffer) Create aUint16Array
instance onbuffer
, 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 aUint16Array
instance onbuffer
, starting atbyteOffset
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 aUint16Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Uint32Array
createUint32Array
(int length) static Uint32Array
createUint32Array
(ArrayBuffer buffer) Create aUint32Array
instance onbuffer
, 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 aUint32Array
instance onbuffer
, starting atbyteOffset
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 aUint32Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Uint8Array
createUint8Array
(int length) static Uint8Array
createUint8Array
(ArrayBuffer buffer) Create aUint8Array
instance onbuffer
, 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 aUint8Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing to the end of the buffer.static Uint8Array
createUint8Array
(ArrayBuffer buffer, int byteOffset, int length) Create aUint8Array
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static Uint8ClampedArray
createUint8ClampedArray
(int length) static Uint8ClampedArray
createUint8ClampedArray
(ArrayBuffer buffer) Create aUint8ClampedArray
instance onbuffer
, starting at starting at the beginning of the buffer and continuing to the end.static Uint8ClampedArray
createUint8ClampedArray
(ArrayBuffer buffer, int byteOffset) Create aUint8ClampedArray
instance onbuffer
, starting atbyteOffset
into the buffer, continuing to the end of the buffer.static Uint8ClampedArray
createUint8ClampedArray
(ArrayBuffer buffer, int byteOffset, int length) Create aUint8ClampedArray
instance onbuffer
, starting atbyteOffset
into the buffer, continuing forlength
elements.static boolean
Check if the current environment supports typed arrays.
-
Constructor Details
-
TypedArrays
public TypedArrays()
-
-
Method Details
-
createArrayBuffer
Create a newArrayBuffer
oflength
bytes.- Parameters:
length
- length of buffer in bytes- Returns:
- an
ArrayBuffer
instance
-
createFloat32Array
- Parameters:
length
- size of array- Returns:
- a
Float32Array
instance
-
createFloat64Array
Create aFloat64Array
instance oflength
elements, backed by a newArrayBuffer
.Note that Safari does not currently support Float64 Arrays!
- Parameters:
length
- size of array- Returns:
- a
Float64Array
instance
-
createInt16Array
- Parameters:
length
- size of array- Returns:
- a
Int16Array
instance
-
createInt32Array
- Parameters:
length
- size of array- Returns:
- a
Int32Array
instance
-
createInt8Array
- Parameters:
length
- size of array- Returns:
- a
Int8Array
instance
-
createUint16Array
- Parameters:
length
- size of array- Returns:
- a
Uint16Array
instance
-
createUint32Array
- Parameters:
length
- size of array- Returns:
- a
Uint32Array
instance
-
createUint8Array
- Parameters:
length
- size of array- Returns:
- a
Uint8Array
instance
-
createUint8ClampedArray
- Parameters:
length
- size of array- Returns:
- a
Uint8ClampedArray
instance
-
isSupported
public static boolean isSupported()Check if the current environment supports typed arrays. Behavior of the variouscreateXXX
methods is undefined if this method returnsfalse
, but will typically throw some exception.- Returns:
- true if typed arrays are support.
-