Class ArrayBufferLibrary

java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.library.Library
com.oracle.truffle.js.api.ArrayBufferLibrary
All Implemented Interfaces:
com.oracle.truffle.api.nodes.NodeInterface, Cloneable

public abstract class ArrayBufferLibrary extends com.oracle.truffle.api.library.Library
ArrayBuffer library provides operations on and information about JavaScript ArrayBuffer objects.
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node

    com.oracle.truffle.api.nodes.Node.Child, com.oracle.truffle.api.nodes.Node.Children
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getByteLength(Object arrayBuffer)
    Returns the byte length of the arrayBuffer.
    getContents(Object arrayBuffer)
    Returns the content of the arrayBuffer.
    static com.oracle.truffle.api.library.LibraryFactory<ArrayBufferLibrary>
    Returns the library factory for the ArrayBuffer library.
    Returns the uncached automatically dispatched version of the ArrayBuffer library.
    boolean
    Returns true if the object is JavaScript ArrayBuffer, returns false otherwise.

    Methods inherited from class com.oracle.truffle.api.library.Library

    accepts

    Methods inherited from class com.oracle.truffle.api.nodes.Node

    accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, reportReplace, toString

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ArrayBufferLibrary

      public ArrayBufferLibrary()
  • Method Details

    • getFactory

      public static com.oracle.truffle.api.library.LibraryFactory<ArrayBufferLibrary> getFactory()
      Returns the library factory for the ArrayBuffer library.
    • getUncached

      public static ArrayBufferLibrary getUncached()
      Returns the uncached automatically dispatched version of the ArrayBuffer library.
    • isArrayBuffer

      public boolean isArrayBuffer(Object object)
      Returns true if the object is JavaScript ArrayBuffer, returns false otherwise.
    • getContents

      public ByteBuffer getContents(Object arrayBuffer) throws com.oracle.truffle.api.interop.UnsupportedMessageException
      Returns the content of the arrayBuffer. Throws UnsupportedMessageException when the receiver is not isArrayBuffer(Object). Returns null when arrayBuffer is detached. May also return null when arrayBuffer wraps non-JavaScript buffer.
      Throws:
      com.oracle.truffle.api.interop.UnsupportedMessageException
    • getByteLength

      public int getByteLength(Object arrayBuffer) throws com.oracle.truffle.api.interop.UnsupportedMessageException
      Returns the byte length of the arrayBuffer. Throws UnsupportedMessageException when the receiver is not isArrayBuffer(Object).
      Throws:
      com.oracle.truffle.api.interop.UnsupportedMessageException