public abstract class TypedArray extends ScriptArray
ScriptArray.CreateWritableProfileAccess, ScriptArray.DefaultIterator, 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| Modifier | Constructor and Description |
|---|---|
protected |
TypedArray(TypedArrayFactory factory,
boolean offset,
byte bufferType) |
| Modifier and Type | Method and Description |
|---|---|
ScriptArray |
addRangeImpl(JSDynamicObject object,
long atOffset,
int size)
This method grows the array by adding more elements of a given size.
|
int |
bytesPerElement() |
ScriptArray |
deleteElementImpl(JSDynamicObject object,
long index,
boolean strict) |
static TypedArrayFactory[] |
factories() |
static TypedArrayFactory[] |
factories(JSContext context) |
long |
firstElementIndex(JSDynamicObject object)
First element index (inclusive).
|
ScriptArray |
freeze() |
abstract Object |
getBufferElement(JSArrayBufferObject buffer,
int index,
boolean littleEndian,
com.oracle.truffle.api.interop.InteropLibrary interop) |
static JSArrayBufferObject |
getBufferFromTypedArray(JSDynamicObject typedArray)
Get ArrayBuffer from TypedArray.
|
protected static byte[] |
getByteArray(JSArrayBufferObject buffer)
Get byte[] from ArrayBuffer.
|
protected static ByteBuffer |
getDirectByteBuffer(JSArrayBufferObject buffer)
Get ByteBuffer from ArrayBuffer with unspecified byte order.
|
abstract TypedArray.ElementType |
getElementType() |
TypedArrayFactory |
getFactory() |
com.oracle.truffle.api.strings.TruffleString |
getName() |
int |
getOffset(JSDynamicObject object) |
boolean |
hasElement(JSDynamicObject object,
long index) |
boolean |
hasHoles(JSDynamicObject 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(JSDynamicObject object)
Last element index (inclusive).
|
long |
length(JSDynamicObject object) |
int |
lengthInt(JSDynamicObject object) |
long |
nextElementIndex(JSDynamicObject object,
long index)
Returns the next index.
|
ScriptArray |
preventExtensions() |
long |
previousElementIndex(JSDynamicObject object,
long index)
Returns the previous index.
|
ScriptArray |
removeRangeImpl(JSDynamicObject object,
long start,
long end)
This function deletes all elements in the range from [start..end[.
|
ScriptArray |
seal() |
abstract void |
setBufferElement(JSArrayBufferObject buffer,
int index,
boolean littleEndian,
Object value,
com.oracle.truffle.api.interop.InteropLibrary interop) |
TypedArray |
setLengthImpl(JSDynamicObject object,
long len,
com.oracle.truffle.api.nodes.Node node,
ScriptArray.SetLengthProfileAccess profile) |
ScriptArray |
setLengthNotWritable() |
protected static JSException |
unsupportedBufferAccess(Object buffer,
com.oracle.truffle.api.interop.UnsupportedMessageException e) |
addRange, asIterable, canDeleteElement, cast, createConstantArray, createConstantEmptyArray, deleteElement, getElement, getElementInBounds, isExtensible, isInBoundsFast, isInstance, makeMultiRangeList, makeRangeList, nextPower, ownPropertyKeys, ownPropertyKeysContiguous, ownPropertyKeysHoles, removeRange, removeRange, setElement, setElementImpl, setLength, setLength, shiftRange, shiftRangeImpl, toArray, 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(JSDynamicObject object)
length in class ScriptArraypublic final int lengthInt(JSDynamicObject object)
lengthInt in class ScriptArraypublic final TypedArray setLengthImpl(JSDynamicObject object, long len, com.oracle.truffle.api.nodes.Node node, ScriptArray.SetLengthProfileAccess profile)
setLengthImpl in class ScriptArraypublic final long firstElementIndex(JSDynamicObject object)
ScriptArrayfirstElementIndex in class ScriptArraypublic final long lastElementIndex(JSDynamicObject object)
ScriptArraylastElementIndex in class ScriptArraypublic final long nextElementIndex(JSDynamicObject object, long index)
ScriptArraynextElementIndex in class ScriptArraypublic final long previousElementIndex(JSDynamicObject object, long index)
ScriptArraypreviousElementIndex in class ScriptArraypublic final ScriptArray deleteElementImpl(JSDynamicObject object, long index, boolean strict)
deleteElementImpl in class ScriptArraypublic final boolean hasElement(JSDynamicObject object, long index)
hasElement in class ScriptArrayprotected static ByteBuffer getDirectByteBuffer(JSArrayBufferObject buffer)
protected static byte[] getByteArray(JSArrayBufferObject buffer)
public static JSArrayBufferObject getBufferFromTypedArray(JSDynamicObject typedArray)
public final int getOffset(JSDynamicObject object)
public final TypedArrayFactory getFactory()
public final int bytesPerElement()
public final com.oracle.truffle.api.strings.TruffleString getName()
public boolean isHolesType()
ScriptArrayisHolesType in class ScriptArraypublic boolean hasHoles(JSDynamicObject object)
hasHoles in class ScriptArraypublic ScriptArray removeRangeImpl(JSDynamicObject object, long start, long end)
ScriptArrayremoveRangeImpl in class ScriptArraypublic ScriptArray addRangeImpl(JSDynamicObject 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 TypedArray.ElementType getElementType()
public abstract Object getBufferElement(JSArrayBufferObject buffer, int index, boolean littleEndian, com.oracle.truffle.api.interop.InteropLibrary interop)
public abstract void setBufferElement(JSArrayBufferObject 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)