public abstract class TypedArray extends ScriptArray
ScriptArray.DefaultIterator, ScriptArray.ProfileAccess, ScriptArray.ProfileHolder, ScriptArray.SetLengthProfileAccess| Modifier and Type | Field and Description |
|---|---|
protected static byte |
BUFFER_TYPE_ARRAY |
protected static byte |
BUFFER_TYPE_DIRECT |
protected static byte |
BUFFER_TYPE_INTEROP |
EMPTY_OBJECT_ARRAY, SET_LENGTH_PROFILE| Modifier | Constructor and Description |
|---|---|
protected |
TypedArray(TypedArrayFactory factory,
boolean offset,
byte bufferType) |
| Modifier and Type | Method and Description |
|---|---|
ScriptArray |
addRangeImpl(com.oracle.truffle.api.object.DynamicObject object,
long atOffset,
int size)
This method grows the array by adding more elements of a given size.
|
int |
bytesPerElement() |
ScriptArray |
deleteElementImpl(com.oracle.truffle.api.object.DynamicObject object,
long index,
boolean strict) |
static TypedArrayFactory[] |
factories() |
static TypedArrayFactory[] |
factories(JSContext context) |
long |
firstElementIndex(com.oracle.truffle.api.object.DynamicObject object)
First element index (inclusive).
|
ScriptArray |
freeze() |
abstract Object |
getBufferElement(Object buffer,
int index,
boolean littleEndian,
com.oracle.truffle.api.interop.InteropLibrary interop) |
static com.oracle.truffle.api.object.DynamicObject |
getBufferFromTypedArray(com.oracle.truffle.api.object.DynamicObject typedArray)
Get ArrayBuffer from TypedArray.
|
protected static byte[] |
getByteArray(Object buffer)
Get byte[] from ArrayBuffer.
|
protected static ByteBuffer |
getDirectByteBuffer(Object buffer)
Get ByteBuffer from ArrayBuffer with unspecified byte order.
|
TypedArrayFactory |
getFactory() |
String |
getName() |
protected int |
getOffset(com.oracle.truffle.api.object.DynamicObject object) |
boolean |
hasElement(com.oracle.truffle.api.object.DynamicObject object,
long index) |
boolean |
hasHoles(com.oracle.truffle.api.object.DynamicObject object) |
boolean |
hasOffset() |
boolean |
isDirect() |
boolean |
isFrozen() |
boolean |
isHolesType()
Returns true when the this array could have hole values in it.
|
boolean |
isInterop() |
boolean |
isLengthNotWritable() |
boolean |
isSealed() |
long |
lastElementIndex(com.oracle.truffle.api.object.DynamicObject object)
Last element index (inclusive).
|
long |
length(com.oracle.truffle.api.object.DynamicObject object) |
int |
lengthInt(com.oracle.truffle.api.object.DynamicObject object) |
long |
nextElementIndex(com.oracle.truffle.api.object.DynamicObject object,
long index)
Returns the next index.
|
ScriptArray |
preventExtensions() |
long |
previousElementIndex(com.oracle.truffle.api.object.DynamicObject object,
long index)
Returns the previous index.
|
ScriptArray |
removeRangeImpl(com.oracle.truffle.api.object.DynamicObject object,
long start,
long end)
This function deletes all elements in the range from [start..end[.
|
ScriptArray |
seal() |
abstract void |
setBufferElement(Object buffer,
int index,
boolean littleEndian,
Object value,
com.oracle.truffle.api.interop.InteropLibrary interop) |
TypedArray |
setLengthImpl(com.oracle.truffle.api.object.DynamicObject object,
long len,
ScriptArray.ProfileHolder profile) |
ScriptArray |
setLengthNotWritable() |
Object[] |
toArray(com.oracle.truffle.api.object.DynamicObject object)
Creates an Object[] from this array, of size array.length.
|
protected static JSException |
unsupportedBufferAccess(Object buffer,
com.oracle.truffle.api.interop.UnsupportedMessageException e) |
addRange, asIterable, canDeleteElement, cast, createConstantArray, createConstantEmptyArray, createSetLengthProfile, deleteElement, getElement, getElementInBounds, isExtensible, isInBoundsFast, isInstance, makeMultiRangeList, makeRangeList, nextPower, ownPropertyKeys, ownPropertyKeysContiguous, ownPropertyKeysHoles, removeRange, removeRange, setElement, setElementImpl, setLength, setLength, toString, traceArrayTransition, traceWrite, valueIsByteprotected static final byte BUFFER_TYPE_ARRAY
protected static final byte BUFFER_TYPE_DIRECT
protected static final byte BUFFER_TYPE_INTEROP
protected TypedArray(TypedArrayFactory factory, boolean offset, byte bufferType)
public final long length(com.oracle.truffle.api.object.DynamicObject object)
length in class ScriptArraypublic final int lengthInt(com.oracle.truffle.api.object.DynamicObject object)
lengthInt in class ScriptArraypublic final TypedArray setLengthImpl(com.oracle.truffle.api.object.DynamicObject object, long len, ScriptArray.ProfileHolder profile)
setLengthImpl in class ScriptArraypublic final long firstElementIndex(com.oracle.truffle.api.object.DynamicObject object)
ScriptArrayfirstElementIndex in class ScriptArraypublic final long lastElementIndex(com.oracle.truffle.api.object.DynamicObject object)
ScriptArraylastElementIndex in class ScriptArraypublic final long nextElementIndex(com.oracle.truffle.api.object.DynamicObject object,
long index)
ScriptArraynextElementIndex in class ScriptArraypublic final long previousElementIndex(com.oracle.truffle.api.object.DynamicObject object,
long index)
ScriptArraypreviousElementIndex in class ScriptArraypublic final Object[] toArray(com.oracle.truffle.api.object.DynamicObject object)
ScriptArraytoArray in class ScriptArraypublic final ScriptArray deleteElementImpl(com.oracle.truffle.api.object.DynamicObject object, long index, boolean strict)
deleteElementImpl in class ScriptArraypublic final boolean hasElement(com.oracle.truffle.api.object.DynamicObject object,
long index)
hasElement in class ScriptArrayprotected static ByteBuffer getDirectByteBuffer(Object buffer)
protected static byte[] getByteArray(Object buffer)
public static com.oracle.truffle.api.object.DynamicObject getBufferFromTypedArray(com.oracle.truffle.api.object.DynamicObject typedArray)
protected final int getOffset(com.oracle.truffle.api.object.DynamicObject object)
public final TypedArrayFactory getFactory()
public final int bytesPerElement()
public final String getName()
public boolean isHolesType()
ScriptArrayisHolesType in class ScriptArraypublic boolean hasHoles(com.oracle.truffle.api.object.DynamicObject object)
hasHoles in class ScriptArraypublic ScriptArray removeRangeImpl(com.oracle.truffle.api.object.DynamicObject object, long start, long end)
ScriptArrayremoveRangeImpl in class ScriptArraypublic ScriptArray addRangeImpl(com.oracle.truffle.api.object.DynamicObject object, long atOffset, int size)
ScriptArrayaddRangeImpl in class ScriptArrayatOffset - starting offset positionsize - size of the inserted empty arrayScriptArray instance with the new sizepublic boolean isSealed()
isSealed in class ScriptArraypublic boolean isFrozen()
isFrozen in class ScriptArraypublic boolean isLengthNotWritable()
isLengthNotWritable in class ScriptArraypublic ScriptArray seal()
seal in class ScriptArraypublic ScriptArray freeze()
freeze in class ScriptArraypublic ScriptArray setLengthNotWritable()
setLengthNotWritable in class ScriptArraypublic ScriptArray preventExtensions()
preventExtensions in class ScriptArraypublic final boolean isDirect()
public final boolean isInterop()
public final boolean hasOffset()
public abstract Object getBufferElement(Object buffer, int index, boolean littleEndian, com.oracle.truffle.api.interop.InteropLibrary interop)
public abstract void setBufferElement(Object buffer, int index, boolean littleEndian, Object value, com.oracle.truffle.api.interop.InteropLibrary interop)
public static TypedArrayFactory[] factories()
public static TypedArrayFactory[] factories(JSContext context)
protected static JSException unsupportedBufferAccess(Object buffer, com.oracle.truffle.api.interop.UnsupportedMessageException e)