public abstract class ArrayBufferViewImpl extends java.lang.Object implements ArrayBufferView
ArrayBufferView
implementations.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ArrayBufferViewImpl(ArrayBuffer buffer,
int byteOffset,
int byteLength) |
Modifier and Type | Method and Description |
---|---|
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.
|
static final boolean USE_LITTLE_ENDIAN
protected final ArrayBufferImpl arrayBuf
protected final int byteLength
protected final int byteOffset
public ArrayBufferViewImpl(ArrayBuffer buffer, int byteOffset, int byteLength)
buffer
- byteOffset
- byteLength
- public ArrayBuffer buffer()
ArrayBufferView
ArrayBuffer
.buffer
in interface ArrayBufferView
ArrayBuffer
instance backing this viewpublic int byteLength()
ArrayBufferView
byteLength
in interface ArrayBufferView
public int byteOffset()
ArrayBufferView
ArrayBuffer
.byteOffset
in interface ArrayBufferView
ArrayBufferView.buffer()
protected int checkRange(int index, int bytesPerElement)
index
- an element indexbytesPerElement
-