com.google.gwt.typedarrays.server

## Class ArrayBufferViewImpl

- java.lang.Object
- - com.google.gwt.typedarrays.server.ArrayBufferViewImpl

All Implemented Interfaces:
  ArrayBufferView

Direct Known Subclasses:
  DataViewImpl, Float32ArrayImpl, Float64ArrayImpl, Int16ArrayImpl, Int32ArrayImpl, Int8ArrayImpl, Uint16ArrayImpl, Uint32ArrayImpl, Uint8ArrayImpl

    public abstract class ArrayBufferViewImpl
    extends java.lang.Object
    implements ArrayBufferView

Base class for `ArrayBufferView` implementations.

### Field Summary

Fields
`protected ArrayBufferImpl` `arrayBuf`
`protected int` `byteLength`
`protected int` `byteOffset`
`(package private) static boolean` `USE_LITTLE_ENDIAN` The spec lets the platform's native endianness come through, so we choose to expose little-endian regardless -- if apps care about the endianness but don't test for it, it is likely they assume little-endian.

### Constructor Summary

Constructors
Constructor and Description
`ArrayBufferViewImpl(ArrayBuffer buffer, int byteOffset, int byteLength)`

### Method Summary

All Methods Instance Methods Concrete Methods
`ArrayBuffer` `buffer()` Get the underlying `ArrayBuffer`.
`int` `byteLength()` Get the length of this view in bytes.
`int` `byteOffset()` Get the offset from the beginning of the underlying `ArrayBuffer`.
`protected int` `checkRange(int index, int bytesPerElement)` Check the index range and throw an exception if out of range, if ok return the byte index of the specified element.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### USE_LITTLE_ENDIAN

    static final boolean USE_LITTLE_ENDIAN

The spec lets the platform's native endianness come through, so we choose to expose little-endian regardless -- if apps care about the endianness but don't test for it, it is likely they assume little-endian.

See Also:
  Constant Field Values

#### arrayBuf

    protected final ArrayBufferImpl arrayBuf

#### byteLength

    protected final int byteLength

#### byteOffset

    protected final int byteOffset

### Constructor Detail

#### ArrayBufferViewImpl

    public ArrayBufferViewImpl(ArrayBuffer buffer,
                               int byteOffset,
                               int byteLength)

Parameters:
  `buffer` -
  `byteOffset` -
  `byteLength` -

### Method Detail

#### 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()`

#### checkRange

    protected int checkRange(int index,
                             int bytesPerElement)

Check the index range and throw an exception if out of range, if ok return the byte index of the specified element.

Parameters:
  `index` - an element index
  `bytesPerElement` -
Returns:
  the byte index of the start of this element