Class DataViewNativeEmul

java.lang.Object
com.google.gwt.typedarrays.client.DataViewNativeEmul
All Implemented Interfaces:
ArrayBufferView, DataView

public class DataViewNativeEmul extends Object implements DataView
JS native implementation of DataView for platforms with typed array support but missing DataView (ie, Firefox).
  • Field Details

    • 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 Details

    • DataViewNativeEmul

      protected DataViewNativeEmul(ArrayBuffer buffer, int byteOffset, int byteLength)
  • Method Details

    • create

      public static DataView create(ArrayBuffer buffer, int byteOffset, int byteLength)
      Parameters:
      buffer -
      byteOffset -
      byteLength -
      Returns:
      a DataView instance
    • buffer

      public ArrayBuffer buffer()
      Description copied from interface: ArrayBufferView
      Get the underlying ArrayBuffer.
      Specified by:
      buffer in interface ArrayBufferView
      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 interface ArrayBufferView
      Returns:
      number of bytes in this view
    • byteOffset

      public int byteOffset()
      Description copied from interface: ArrayBufferView
      Get the offset from the beginning of the underlying ArrayBuffer.
      Specified by:
      byteOffset in interface ArrayBufferView
      Returns:
      0-based offset from the beginning of ArrayBufferView.buffer()
    • getFloat32

      public float getFloat32(int byteOffset)
      Specified by:
      getFloat32 in interface DataView
    • getFloat32

      public float getFloat32(int byteOffset, boolean littleEndian)
      Specified by:
      getFloat32 in interface DataView
    • getFloat64

      public double getFloat64(int byteOffset)
      Specified by:
      getFloat64 in interface DataView
    • getFloat64

      public double getFloat64(int byteOffset, boolean littleEndian)
      Specified by:
      getFloat64 in interface DataView
    • getInt16

      public short getInt16(int byteOffset)
      Specified by:
      getInt16 in interface DataView
    • getInt16

      public short getInt16(int byteOffset, boolean littleEndian)
      Specified by:
      getInt16 in interface DataView
    • getInt32

      public int getInt32(int byteOffset)
      Specified by:
      getInt32 in interface DataView
    • getInt32

      public int getInt32(int byteOffset, boolean littleEndian)
      Specified by:
      getInt32 in interface DataView
    • getInt8

      public byte getInt8(int byteOffset)
      Specified by:
      getInt8 in interface DataView
    • getUint16

      public int getUint16(int byteOffset)
      Specified by:
      getUint16 in interface DataView
    • getUint16

      public int getUint16(int byteOffset, boolean littleEndian)
      Specified by:
      getUint16 in interface DataView
    • getUint32

      public long getUint32(int byteOffset)
      Specified by:
      getUint32 in interface DataView
    • getUint32

      public long getUint32(int byteOffset, boolean littleEndian)
      Specified by:
      getUint32 in interface DataView
    • getUint32AsDouble

      public double getUint32AsDouble(int byteOffset)
      Specified by:
      getUint32AsDouble in interface DataView
      Returns:
      unsigned 32-bit int as a double
    • getUint32AsDouble

      public double getUint32AsDouble(int byteOffset, boolean littleEndian)
      Specified by:
      getUint32AsDouble in interface DataView
      Returns:
      unsigned 32-bit int as a double
    • getUint8

      public short getUint8(int byteOffset)
      Specified by:
      getUint8 in interface DataView
    • setFloat32

      public void setFloat32(int byteOffset, float value)
      Specified by:
      setFloat32 in interface DataView
    • setFloat32

      public void setFloat32(int byteOffset, float value, boolean littleEndian)
      Specified by:
      setFloat32 in interface DataView
    • setFloat64

      public void setFloat64(int byteOffset, double value)
      Specified by:
      setFloat64 in interface DataView
    • setFloat64

      public void setFloat64(int byteOffset, double value, boolean littleEndian)
      Specified by:
      setFloat64 in interface DataView
    • setInt16

      public void setInt16(int byteOffset, int value)
      Specified by:
      setInt16 in interface DataView
    • setInt16

      public void setInt16(int byteOffset, int value, boolean littleEndian)
      Specified by:
      setInt16 in interface DataView
    • setInt32

      public void setInt32(int byteOffset, int value)
      Specified by:
      setInt32 in interface DataView
    • setInt32

      public void setInt32(int byteOffset, int value, boolean littleEndian)
      Specified by:
      setInt32 in interface DataView
    • setInt8

      public void setInt8(int byteOffset, int value)
      Specified by:
      setInt8 in interface DataView
    • setUint16

      public void setUint16(int byteOffset, int value)
      Specified by:
      setUint16 in interface DataView
    • setUint16

      public void setUint16(int byteOffset, int value, boolean littleEndian)
      Specified by:
      setUint16 in interface DataView
    • setUint32

      public void setUint32(int byteOffset, long value)
      Specified by:
      setUint32 in interface DataView
    • setUint32

      public void setUint32(int byteOffset, long value, boolean littleEndian)
      Specified by:
      setUint32 in interface DataView
    • setUint32FromDouble

      public void setUint32FromDouble(int byteOffset, double value)
      Specified by:
      setUint32FromDouble in interface DataView
    • setUint32FromDouble

      public void setUint32FromDouble(int byteOffset, double value, boolean littleEndian)
      Specified by:
      setUint32FromDouble in interface DataView
    • setUint8

      public void setUint8(int byteOffset, int value)
      Specified by:
      setUint8 in interface DataView
    • 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 into buffer
      len - number of bytes to copy
      dest -
      destOfs -