Class DataViewNativeEmul
java.lang.Object
com.google.gwt.typedarrays.client.DataViewNativeEmul
- All Implemented Interfaces:
ArrayBufferView
,DataView
JS native implementation of
DataView
for platforms with typed array
support but missing DataView (ie, Firefox).-
Field Summary
Modifier and TypeFieldDescriptionprotected final ArrayBuffer
protected final int
protected final int
protected final Uint8ArrayNative
A temporary buffer used for reversing bytes.protected final Uint8ArrayNative
A view of the underlying buffer as bytes. -
Constructor Summary
ModifierConstructorDescriptionprotected
DataViewNativeEmul
(ArrayBuffer buffer, int byteOffset, int byteLength) -
Method Summary
Modifier and TypeMethodDescriptionbuffer()
Get the underlyingArrayBuffer
.int
Get the length of this view in bytes.int
Get the offset from the beginning of the underlyingArrayBuffer
.static DataView
create
(ArrayBuffer buffer, int byteOffset, int byteLength) float
getFloat32
(int byteOffset) float
getFloat32
(int byteOffset, boolean littleEndian) double
getFloat64
(int byteOffset) double
getFloat64
(int byteOffset, boolean littleEndian) short
getInt16
(int byteOffset) short
getInt16
(int byteOffset, boolean littleEndian) int
getInt32
(int byteOffset) int
getInt32
(int byteOffset, boolean littleEndian) byte
getInt8
(int byteOffset) int
getUint16
(int byteOffset) int
getUint16
(int byteOffset, boolean littleEndian) long
getUint32
(int byteOffset) long
getUint32
(int byteOffset, boolean littleEndian) double
getUint32AsDouble
(int byteOffset) double
getUint32AsDouble
(int byteOffset, boolean littleEndian) short
getUint8
(int byteOffset) protected final void
reverseBytes
(Uint8ArrayNative src, int srcOfs, int len, Uint8ArrayNative dest, int destOfs) Copy bytes from the underlying buffer to a temporary buffer, reversing them in the process.void
setFloat32
(int byteOffset, float value) void
setFloat32
(int byteOffset, float value, boolean littleEndian) void
setFloat64
(int byteOffset, double value) void
setFloat64
(int byteOffset, double value, boolean littleEndian) void
setInt16
(int byteOffset, int value) void
setInt16
(int byteOffset, int value, boolean littleEndian) void
setInt32
(int byteOffset, int value) void
setInt32
(int byteOffset, int value, boolean littleEndian) void
setInt8
(int byteOffset, int value) void
setUint16
(int byteOffset, int value) void
setUint16
(int byteOffset, int value, boolean littleEndian) void
setUint32
(int byteOffset, long value) void
setUint32
(int byteOffset, long value, boolean littleEndian) void
setUint32FromDouble
(int byteOffset, double value) void
setUint32FromDouble
(int byteOffset, double value, boolean littleEndian) void
setUint8
(int byteOffset, int value)
-
Field Details
-
buffer
-
bufferByteOffset
protected final int bufferByteOffset -
byteLength
protected final int byteLength -
tempBuffer
A temporary buffer used for reversing bytes. -
uint8Array
A view of the underlying buffer as bytes.
-
-
Constructor Details
-
Method Details
-
buffer
Description copied from interface:ArrayBufferView
Get the underlyingArrayBuffer
.- Specified by:
buffer
in interfaceArrayBufferView
- Returns:
- the
ArrayBuffer
instance backing this view
-
byteLength
public int byteLength()Description copied from interface:ArrayBufferView
Get the length of this view in bytes.- Specified by:
byteLength
in interfaceArrayBufferView
- Returns:
- number of bytes in this view
-
byteOffset
public int byteOffset()Description copied from interface:ArrayBufferView
Get the offset from the beginning of the underlyingArrayBuffer
.- Specified by:
byteOffset
in interfaceArrayBufferView
- Returns:
- 0-based offset from the beginning of
ArrayBufferView.buffer()
-
getFloat32
public float getFloat32(int byteOffset) - Specified by:
getFloat32
in interfaceDataView
-
getFloat32
public float getFloat32(int byteOffset, boolean littleEndian) - Specified by:
getFloat32
in interfaceDataView
-
getFloat64
public double getFloat64(int byteOffset) - Specified by:
getFloat64
in interfaceDataView
-
getFloat64
public double getFloat64(int byteOffset, boolean littleEndian) - Specified by:
getFloat64
in interfaceDataView
-
getInt16
public short getInt16(int byteOffset) -
getInt16
public short getInt16(int byteOffset, boolean littleEndian) -
getInt32
public int getInt32(int byteOffset) -
getInt32
public int getInt32(int byteOffset, boolean littleEndian) -
getInt8
public byte getInt8(int byteOffset) -
getUint16
public int getUint16(int byteOffset) -
getUint16
public int getUint16(int byteOffset, boolean littleEndian) -
getUint32
public long getUint32(int byteOffset) -
getUint32
public long getUint32(int byteOffset, boolean littleEndian) -
getUint32AsDouble
public double getUint32AsDouble(int byteOffset) - Specified by:
getUint32AsDouble
in interfaceDataView
- Parameters:
byteOffset
-- Returns:
- unsigned 32-bit int as a double
-
getUint32AsDouble
public double getUint32AsDouble(int byteOffset, boolean littleEndian) - Specified by:
getUint32AsDouble
in interfaceDataView
- Parameters:
byteOffset
-littleEndian
-- Returns:
- unsigned 32-bit int as a double
-
getUint8
public short getUint8(int byteOffset) -
setFloat32
public void setFloat32(int byteOffset, float value) - Specified by:
setFloat32
in interfaceDataView
-
setFloat32
public void setFloat32(int byteOffset, float value, boolean littleEndian) - Specified by:
setFloat32
in interfaceDataView
-
setFloat64
public void setFloat64(int byteOffset, double value) - Specified by:
setFloat64
in interfaceDataView
-
setFloat64
public void setFloat64(int byteOffset, double value, boolean littleEndian) - Specified by:
setFloat64
in interfaceDataView
-
setInt16
public void setInt16(int byteOffset, int value) -
setInt16
public void setInt16(int byteOffset, int value, boolean littleEndian) -
setInt32
public void setInt32(int byteOffset, int value) -
setInt32
public void setInt32(int byteOffset, int value, boolean littleEndian) -
setInt8
public void setInt8(int byteOffset, int value) -
setUint16
public void setUint16(int byteOffset, int value) -
setUint16
public void setUint16(int byteOffset, int value, boolean littleEndian) -
setUint32
public void setUint32(int byteOffset, long value) -
setUint32
public void setUint32(int byteOffset, long value, boolean littleEndian) -
setUint32FromDouble
public void setUint32FromDouble(int byteOffset, double value) - Specified by:
setUint32FromDouble
in interfaceDataView
- Parameters:
byteOffset
-value
-
-
setUint32FromDouble
public void setUint32FromDouble(int byteOffset, double value, boolean littleEndian) - Specified by:
setUint32FromDouble
in interfaceDataView
- Parameters:
byteOffset
-value
-littleEndian
-
-
setUint8
public void setUint8(int byteOffset, int value) -
reverseBytes
protected final void reverseBytes(Uint8ArrayNative src, int srcOfs, int len, Uint8ArrayNative dest, int destOfs) Copy bytes from the underlying buffer to a temporary buffer, reversing them in the process.- Parameters:
src
-srcOfs
- offset intobuffer
len
- number of bytes to copydest
-destOfs
-