Class DirectClosureBuffer

  • All Implemented Interfaces:
    Closure.Buffer

    final class DirectClosureBuffer
    extends java.lang.Object
    implements Closure.Buffer
    Implementation of the Closure.Buffer interface to read/write parameter and return value data in native memory
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getAddress​(int index)
      Gets the value of a native pointer parameter.
      byte getByte​(int index)
      Gets the value of an 8 bit integer parameter.
      double getDouble​(int index)
      Gets the value of a 64 bit floating point parameter.
      float getFloat​(int index)
      Gets the value of a 32 bit floating point parameter.
      int getInt​(int index)
      Gets the value of a 32 bit integer parameter.
      long getLong​(int index)
      Gets the value of a 64 bit integer parameter.
      short getShort​(int index)
      Gets the value of a 16 bit integer parameter.
      long getStruct​(int index)
      Gets the address of a struct parameter that is passed by value.
      void setAddressReturn​(long address)
      Sets the closure return value to a native pointer value.
      void setByteReturn​(byte value)
      Sets the closure return value to an 8 bit integer value.
      void setDoubleReturn​(double value)
      Sets the closure return value to a 64 bit floating point value.
      void setFloatReturn​(float value)
      Sets the closure return value to a 32 bit floating point value.
      void setIntReturn​(int value)
      Sets the closure return value to a 32 bit integer value.
      void setLongReturn​(long value)
      Sets the closure return value to a 64 bit integer value.
      void setShortReturn​(short value)
      Sets the closure return value to a 16 bit integer value.
      void setStructReturn​(byte[] data, int offset)
      Sets the closure return value to the contents of a struct
      void setStructReturn​(long value)
      Sets the closure return value to the contents of a struct
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PARAM_SIZE

        private static final long PARAM_SIZE
      • retval

        private final long retval
      • parameters

        private final long parameters
    • Constructor Detail

      • DirectClosureBuffer

        public DirectClosureBuffer​(CallContext callContext,
                                   long retval,
                                   long parameters)
    • Method Detail

      • getByte

        public final byte getByte​(int index)
        Description copied from interface: Closure.Buffer
        Gets the value of an 8 bit integer parameter.
        Specified by:
        getByte in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        An 8 bit integer value.
      • getShort

        public final short getShort​(int index)
        Description copied from interface: Closure.Buffer
        Gets the value of a 16 bit integer parameter.
        Specified by:
        getShort in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        A 16 bit integer value.
      • getInt

        public final int getInt​(int index)
        Description copied from interface: Closure.Buffer
        Gets the value of a 32 bit integer parameter.
        Specified by:
        getInt in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        A 32 bit integer value.
      • getLong

        public final long getLong​(int index)
        Description copied from interface: Closure.Buffer
        Gets the value of a 64 bit integer parameter.
        Specified by:
        getLong in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        A 64 bit integer value.
      • getFloat

        public final float getFloat​(int index)
        Description copied from interface: Closure.Buffer
        Gets the value of a 32 bit floating point parameter.
        Specified by:
        getFloat in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        A 32 bit floating point value.
      • getDouble

        public final double getDouble​(int index)
        Description copied from interface: Closure.Buffer
        Gets the value of a 64 bit floating point parameter.
        Specified by:
        getDouble in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        A 64 bit floating point value.
      • getAddress

        public final long getAddress​(int index)
        Description copied from interface: Closure.Buffer
        Gets the value of a native pointer parameter.
        Specified by:
        getAddress in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        A native memory address.
      • getStruct

        public final long getStruct​(int index)
        Description copied from interface: Closure.Buffer
        Gets the address of a struct parameter that is passed by value.
        Specified by:
        getStruct in interface Closure.Buffer
        Parameters:
        index - The parameter index
        Returns:
        A native memory address.
      • setByteReturn

        public final void setByteReturn​(byte value)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to an 8 bit integer value.
        Specified by:
        setByteReturn in interface Closure.Buffer
        Parameters:
        value - The 8 bit integer value to return from the closure.
      • setShortReturn

        public final void setShortReturn​(short value)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to a 16 bit integer value.
        Specified by:
        setShortReturn in interface Closure.Buffer
        Parameters:
        value - The 16 bit integer value to return from the closure.
      • setIntReturn

        public final void setIntReturn​(int value)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to a 32 bit integer value.
        Specified by:
        setIntReturn in interface Closure.Buffer
        Parameters:
        value - The 32 bit integer value to return from the closure.
      • setLongReturn

        public final void setLongReturn​(long value)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to a 64 bit integer value.
        Specified by:
        setLongReturn in interface Closure.Buffer
        Parameters:
        value - The 64 bit integer value to return from the closure.
      • setFloatReturn

        public final void setFloatReturn​(float value)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to a 32 bit floating point value.
        Specified by:
        setFloatReturn in interface Closure.Buffer
        Parameters:
        value - The 32 bit floating point value to return from the closure.
      • setDoubleReturn

        public final void setDoubleReturn​(double value)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to a 64 bit floating point value.
        Specified by:
        setDoubleReturn in interface Closure.Buffer
        Parameters:
        value - The 64 bit floating point value to return from the closure.
      • setAddressReturn

        public final void setAddressReturn​(long address)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to a native pointer value.
        Specified by:
        setAddressReturn in interface Closure.Buffer
        Parameters:
        address - The native pointer value to return from the closure.
      • setStructReturn

        public void setStructReturn​(long value)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to the contents of a struct
        Specified by:
        setStructReturn in interface Closure.Buffer
        Parameters:
        value - The address of a native struct to return as a struct value from the closure.
      • setStructReturn

        public void setStructReturn​(byte[] data,
                                    int offset)
        Description copied from interface: Closure.Buffer
        Sets the closure return value to the contents of a struct
        Specified by:
        setStructReturn in interface Closure.Buffer
        Parameters:
        data - Struct data packed into a byte array to return as a struct value from the closure.
        offset - the offset within the byte array to start copying data