Class DataViewNativeEmul
- java.lang.Object
-
- com.google.gwt.typedarrays.client.DataViewNativeEmul
-
- All Implemented Interfaces:
ArrayBufferView,DataView
public class DataViewNativeEmul extends java.lang.Object implements DataView
JS native implementation ofDataViewfor platforms with typed array support but missing DataView (ie, Firefox).
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayBufferbufferprotected intbufferByteOffsetprotected intbyteLengthprotected Uint8ArrayNativetempBufferA temporary buffer used for reversing bytes.protected Uint8ArrayNativeuint8ArrayA view of the underlying buffer as bytes.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDataViewNativeEmul(ArrayBuffer buffer, int byteOffset, int byteLength)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayBufferbuffer()Get the underlyingArrayBuffer.intbyteLength()Get the length of this view in bytes.intbyteOffset()Get the offset from the beginning of the underlyingArrayBuffer.static DataViewcreate(ArrayBuffer buffer, int byteOffset, int byteLength)floatgetFloat32(int byteOffset)floatgetFloat32(int byteOffset, boolean littleEndian)doublegetFloat64(int byteOffset)doublegetFloat64(int byteOffset, boolean littleEndian)shortgetInt16(int byteOffset)shortgetInt16(int byteOffset, boolean littleEndian)intgetInt32(int byteOffset)intgetInt32(int byteOffset, boolean littleEndian)bytegetInt8(int byteOffset)intgetUint16(int byteOffset)intgetUint16(int byteOffset, boolean littleEndian)longgetUint32(int byteOffset)longgetUint32(int byteOffset, boolean littleEndian)doublegetUint32AsDouble(int byteOffset)doublegetUint32AsDouble(int byteOffset, boolean littleEndian)shortgetUint8(int byteOffset)protected voidreverseBytes(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.voidsetFloat32(int byteOffset, float value)voidsetFloat32(int byteOffset, float value, boolean littleEndian)voidsetFloat64(int byteOffset, double value)voidsetFloat64(int byteOffset, double value, boolean littleEndian)voidsetInt16(int byteOffset, int value)voidsetInt16(int byteOffset, int value, boolean littleEndian)voidsetInt32(int byteOffset, int value)voidsetInt32(int byteOffset, int value, boolean littleEndian)voidsetInt8(int byteOffset, int value)voidsetUint16(int byteOffset, int value)voidsetUint16(int byteOffset, int value, boolean littleEndian)voidsetUint32(int byteOffset, long value)voidsetUint32(int byteOffset, long value, boolean littleEndian)voidsetUint32FromDouble(int byteOffset, double value)voidsetUint32FromDouble(int byteOffset, double value, boolean littleEndian)voidsetUint8(int byteOffset, int value)
-
-
-
Field Detail
-
buffer
protected final ArrayBuffer buffer
-
bufferByteOffset
protected final int bufferByteOffset
-
byteLength
protected final int byteLength
-
tempBuffer
protected final Uint8ArrayNative tempBuffer
A temporary buffer used for reversing bytes.
-
uint8Array
protected final Uint8ArrayNative uint8Array
A view of the underlying buffer as bytes.
-
-
Constructor Detail
-
DataViewNativeEmul
protected DataViewNativeEmul(ArrayBuffer buffer, int byteOffset, int byteLength)
-
-
Method Detail
-
create
public static DataView create(ArrayBuffer buffer, int byteOffset, int byteLength)
- Parameters:
buffer-byteOffset-byteLength-- Returns:
- a
DataViewinstance
-
buffer
public ArrayBuffer buffer()
Description copied from interface:ArrayBufferViewGet the underlyingArrayBuffer.- Specified by:
bufferin interfaceArrayBufferView- Returns:
- the
ArrayBufferinstance backing this view
-
byteLength
public int byteLength()
Description copied from interface:ArrayBufferViewGet the length of this view in bytes.- Specified by:
byteLengthin interfaceArrayBufferView- Returns:
- number of bytes in this view
-
byteOffset
public int byteOffset()
Description copied from interface:ArrayBufferViewGet the offset from the beginning of the underlyingArrayBuffer.- Specified by:
byteOffsetin interfaceArrayBufferView- Returns:
- 0-based offset from the beginning of
ArrayBufferView.buffer()
-
getFloat32
public float getFloat32(int byteOffset)
- Specified by:
getFloat32in interfaceDataView
-
getFloat32
public float getFloat32(int byteOffset, boolean littleEndian)- Specified by:
getFloat32in interfaceDataView
-
getFloat64
public double getFloat64(int byteOffset)
- Specified by:
getFloat64in interfaceDataView
-
getFloat64
public double getFloat64(int byteOffset, boolean littleEndian)- Specified by:
getFloat64in interfaceDataView
-
getInt16
public short getInt16(int byteOffset, boolean littleEndian)
-
getInt32
public int getInt32(int byteOffset, boolean littleEndian)
-
getUint16
public int getUint16(int byteOffset, boolean littleEndian)
-
getUint32
public long getUint32(int byteOffset, boolean littleEndian)
-
getUint32AsDouble
public double getUint32AsDouble(int byteOffset)
- Specified by:
getUint32AsDoublein interfaceDataView- Returns:
- unsigned 32-bit int as a double
-
getUint32AsDouble
public double getUint32AsDouble(int byteOffset, boolean littleEndian)- Specified by:
getUint32AsDoublein interfaceDataView- Returns:
- unsigned 32-bit int as a double
-
setFloat32
public void setFloat32(int byteOffset, float value)- Specified by:
setFloat32in interfaceDataView
-
setFloat32
public void setFloat32(int byteOffset, float value, boolean littleEndian)- Specified by:
setFloat32in interfaceDataView
-
setFloat64
public void setFloat64(int byteOffset, double value)- Specified by:
setFloat64in interfaceDataView
-
setFloat64
public void setFloat64(int byteOffset, double value, boolean littleEndian)- Specified by:
setFloat64in 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)
-
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:
setUint32FromDoublein interfaceDataView
-
setUint32FromDouble
public void setUint32FromDouble(int byteOffset, double value, boolean littleEndian)- Specified by:
setUint32FromDoublein interfaceDataView
-
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 intobufferlen- number of bytes to copydest-destOfs-
-
-