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
Nested ClassesModifier and TypeClassDescriptionstatic classBase class of implementations for creating various typed array structures. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayBuffercreateArrayBuffer(int length) Create a newArrayBufferoflengthbytes.static DataViewcreateDataView(ArrayBuffer buffer) Create a newDataViewinstance on anArrayBuffer.static DataViewcreateDataView(ArrayBuffer buffer, int byteOffset) static DataViewcreateDataView(ArrayBuffer buffer, int byteOffset, int byteLength) Create a newDataViewinstance on anArrayBuffer, starting at an offset ofbyteOffsetand continuing forlengthbytes.static Float32ArraycreateFloat32Array(int length) static Float32ArraycreateFloat32Array(ArrayBuffer buffer) Create aFloat32Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end (which must be an integral number of elements).static Float32ArraycreateFloat32Array(ArrayBuffer buffer, int byteOffset) Create aFloat32Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer (which must be an integral number of elements).static Float32ArraycreateFloat32Array(ArrayBuffer buffer, int byteOffset, int length) Create aFloat32Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Float64ArraycreateFloat64Array(int length) static Float64ArraycreateFloat64Array(ArrayBuffer buffer) Create aFloat64Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end (which must be an integral number of elements).static Float64ArraycreateFloat64Array(ArrayBuffer buffer, int byteOffset) Create aFloat64Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer (which must be an integral number of elements).static Float64ArraycreateFloat64Array(ArrayBuffer buffer, int byteOffset, int length) Create aFloat64Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Int16ArraycreateInt16Array(int length) static Int16ArraycreateInt16Array(ArrayBuffer buffer) Create aInt16Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end (which must be an integral number of elements).static Int16ArraycreateInt16Array(ArrayBuffer buffer, int byteOffset) Create aInt16Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer (which must be an integral number of elements).static Int16ArraycreateInt16Array(ArrayBuffer buffer, int byteOffset, int length) Create aInt16Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Int32ArraycreateInt32Array(int length) static Int32ArraycreateInt32Array(ArrayBuffer buffer) Create aInt32Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end (which must be an integral number of elements).static Int32ArraycreateInt32Array(ArrayBuffer buffer, int byteOffset) Create aInt32Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer (which must be an integral number of elements).static Int32ArraycreateInt32Array(ArrayBuffer buffer, int byteOffset, int length) Create aInt32Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Int8ArraycreateInt8Array(int length) static Int8ArraycreateInt8Array(ArrayBuffer buffer) Create aInt8Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end.static Int8ArraycreateInt8Array(ArrayBuffer buffer, int byteOffset) Create aInt8Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer (which must be an integral number of elements).static Int8ArraycreateInt8Array(ArrayBuffer buffer, int byteOffset, int length) Create aInt8Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Uint16ArraycreateUint16Array(int length) static Uint16ArraycreateUint16Array(ArrayBuffer buffer) Create aUint16Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end (which must be an integral number of elements).static Uint16ArraycreateUint16Array(ArrayBuffer buffer, int byteOffset) Create aUint16Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer (which must be an integral number of elements).static Uint16ArraycreateUint16Array(ArrayBuffer buffer, int byteOffset, int length) Create aUint16Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Uint32ArraycreateUint32Array(int length) static Uint32ArraycreateUint32Array(ArrayBuffer buffer) Create aUint32Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end (which must be an integral number of elements).static Uint32ArraycreateUint32Array(ArrayBuffer buffer, int byteOffset) Create aUint32Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer (which must be an integral number of elements).static Uint32ArraycreateUint32Array(ArrayBuffer buffer, int byteOffset, int length) Create aUint32Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Uint8ArraycreateUint8Array(int length) static Uint8ArraycreateUint8Array(ArrayBuffer buffer) Create aUint8Arrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end (which must be an integral number of elements).static Uint8ArraycreateUint8Array(ArrayBuffer buffer, int byteOffset) Create aUint8Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer.static Uint8ArraycreateUint8Array(ArrayBuffer buffer, int byteOffset, int length) Create aUint8Arrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static Uint8ClampedArraycreateUint8ClampedArray(int length) static Uint8ClampedArraycreateUint8ClampedArray(ArrayBuffer buffer) Create aUint8ClampedArrayinstance onbuffer, starting at starting at the beginning of the buffer and continuing to the end.static Uint8ClampedArraycreateUint8ClampedArray(ArrayBuffer buffer, int byteOffset) Create aUint8ClampedArrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing to the end of the buffer.static Uint8ClampedArraycreateUint8ClampedArray(ArrayBuffer buffer, int byteOffset, int length) Create aUint8ClampedArrayinstance onbuffer, starting atbyteOffsetinto the buffer, continuing forlengthelements.static booleanCheck if the current environment supports typed arrays.
-
Constructor Details
-
TypedArrays
public TypedArrays()
-
-
Method Details
-
createArrayBuffer
Create a newArrayBufferoflengthbytes.- Parameters:
length- length of buffer in bytes- Returns:
- an
ArrayBufferinstance
-
createFloat32Array
- Parameters:
length- size of array- Returns:
- a
Float32Arrayinstance
-
createFloat64Array
Create aFloat64Arrayinstance oflengthelements, backed by a newArrayBuffer.Note that Safari does not currently support Float64 Arrays!
- Parameters:
length- size of array- Returns:
- a
Float64Arrayinstance
-
createInt16Array
- Parameters:
length- size of array- Returns:
- a
Int16Arrayinstance
-
createInt32Array
- Parameters:
length- size of array- Returns:
- a
Int32Arrayinstance
-
createInt8Array
- Parameters:
length- size of array- Returns:
- a
Int8Arrayinstance
-
createUint16Array
- Parameters:
length- size of array- Returns:
- a
Uint16Arrayinstance
-
createUint32Array
- Parameters:
length- size of array- Returns:
- a
Uint32Arrayinstance
-
createUint8Array
- Parameters:
length- size of array- Returns:
- a
Uint8Arrayinstance
-
createUint8ClampedArray
- Parameters:
length- size of array- Returns:
- a
Uint8ClampedArrayinstance
-
isSupported
public static boolean isSupported()Check if the current environment supports typed arrays. Behavior of the variouscreateXXXmethods is undefined if this method returnsfalse, but will typically throw some exception.- Returns:
- true if typed arrays are support.
-