Package org.jocl

Class NativePointerObject

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.Buffer buffer
      The buffer the pointer points to
      private long byteOffset
      The offset from the nativePointer, in bytes
      private long nativePointer
      The native pointer, written by native methods
      private NativePointerObject[] pointers
      The array of pointers this pointer points to
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      (package private) java.nio.Buffer getBuffer()
      Returns the Buffer of this Pointer
      (package private) long getByteOffset()
      Returns the byte offset
      long getNativePointer()
      Method to obtain the native pointer value.
      int hashCode()  
      (package private) void setBuffer​(java.nio.Buffer buffer)
      Set the given buffer as the contents of this Pointer
      java.lang.String toString()
      Returns a String representation of this object.
      (package private) NativePointerObject withByteOffset​(long byteOffset)
      Returns a new pointer with an offset of the given number of bytes
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • nativePointer

        private long nativePointer
        The native pointer, written by native methods
      • byteOffset

        private long byteOffset
        The offset from the nativePointer, in bytes
      • buffer

        private java.nio.Buffer buffer
        The buffer the pointer points to
      • pointers

        private NativePointerObject[] pointers
        The array of pointers this pointer points to
    • Constructor Detail

      • NativePointerObject

        protected NativePointerObject()
        Creates a new (null) Pointer
      • NativePointerObject

        NativePointerObject​(java.nio.Buffer buffer)
        Creates a Pointer to the given Buffer
        Parameters:
        buffer - The buffer to point to
      • NativePointerObject

        NativePointerObject​(NativePointerObject[] pointers)
        Creates a Pointer to the given array of pointers
        Parameters:
        pointers - The array the pointer points to
      • NativePointerObject

        NativePointerObject​(NativePointerObject other)
        Copy constructor
        Parameters:
        other - The other Pointer
      • NativePointerObject

        NativePointerObject​(NativePointerObject other,
                            long byteOffset)
        Creates a copy of the given pointer, with an additional byte offset
        Parameters:
        other - The other pointer
        byteOffset - The additional byte offset
    • Method Detail

      • getNativePointer

        public long getNativePointer()
        Method to obtain the native pointer value. Clients should usually not use this pointer value directly. It is only intended for interoperability with other JNI based libraries.
        Returns:
        The native pointer value
      • getByteOffset

        long getByteOffset()
        Returns the byte offset
        Returns:
        The byte offset
      • setBuffer

        void setBuffer​(java.nio.Buffer buffer)
        Set the given buffer as the contents of this Pointer
        Parameters:
        buffer - The buffer to set
      • getBuffer

        java.nio.Buffer getBuffer()
        Returns the Buffer of this Pointer
        Returns:
        The Buffer of this Pointer
      • withByteOffset

        NativePointerObject withByteOffset​(long byteOffset)
        Returns a new pointer with an offset of the given number of bytes
        Parameters:
        byteOffset - The byte offset for the pointer
        Returns:
        The new pointer with the given byte offset
      • toString

        public java.lang.String toString()
        Returns a String representation of this object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String representation of this object.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object