Pointer

abstract class Pointer : AutoCloseable

Class managing a native pointer.

None of the methods in this class require to be run on the main thread, however they require to be run always on the same thread. To pass it to a different thread, you can change the pointers's thread but beware that the native code, when using the pointer directly, generally does NOT check the pointer's thread.

A pointer manages resources. You should explicitly close it. However, if that is hard to achieve, you can omit that and it will close automatically when it is garbage collected. Note that this can cause problems in working threads and you should prefer to close it there explicitly. Moreover the size of the pointer's data is invisible to the garbage collector which, if large, may put a lot of pressure on memory that the garbage collector won't know how to resolve efficiently (e.g. preferring to collect other objects first).

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
Exception thrown when trying to modify a read-only pointer.

Functions

Link copied to clipboard
open fun changeThread()
Change thread this pointer can be accessed from to the current one.
Link copied to clipboard
open fun close()
Close the native pointer.
Link copied to clipboard
open fun equals(@Nullable o: Any): Boolean
Check if the pointer is equal to another one.
Link copied to clipboard
open fun hashCode(): Int
Get hash code.
Link copied to clipboard
open fun isClosed(): Boolean
Check if the native pointer is closed.
Link copied to clipboard
open fun isMutable(): Boolean
Check if the native pointer is mutable.
Link copied to clipboard
open fun isSamePointer(@NonNull other: Pointer): Boolean
Check if the pointer is the same as in another pointer.
Link copied to clipboard
open fun toString(): String
Report string describing this pointer.