Package org.jocl
Class NativePointerObject
- java.lang.Object
-
- org.jocl.NativePointerObject
-
- Direct Known Subclasses:
cl_abstract_properties
,cl_command_queue
,cl_context
,cl_device_id
,cl_event
,cl_kernel
,cl_mem
,cl_platform_id
,cl_program
,cl_sampler
,Pointer
public class NativePointerObject extends java.lang.Object
Base class for all classes that store a native pointer
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.Buffer
buffer
The buffer the pointer points toprivate long
byteOffset
The offset from the nativePointer, in bytesprivate long
nativePointer
The native pointer, written by native methodsprivate NativePointerObject[]
pointers
The array of pointers this pointer points to
-
Constructor Summary
Constructors Modifier Constructor Description protected
NativePointerObject()
Creates a new (null) Pointer(package private)
NativePointerObject(java.nio.Buffer buffer)
Creates a Pointer to the given Buffer(package private)
NativePointerObject(NativePointerObject other)
Copy constructor(package private)
NativePointerObject(NativePointerObject[] pointers)
Creates a Pointer to the given array of pointers(package private)
NativePointerObject(NativePointerObject other, long byteOffset)
Creates a copy of the given pointer, with an additional byte offset
-
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 offsetlong
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 Pointerjava.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
-
-
-
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 pointerbyteOffset
- 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 classjava.lang.Object
- Returns:
- A String representation of this object.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-