Pointer

public class Pointer

Pointer class to handle pointers.

Have automatic cleanup with using releasers.

Constructors

Pointer

public Pointer(long peer, Releaser releaser)

Constructs a Pointer object for a native pointer with a given releaser.

Parameters:
  • peer – The native peer pointer.
  • releaser – The releaser instance responsible for cleanup after this object has been collected by the GC.

Pointer

public Pointer(long peer)

Constructs a Pointer object for a native pointer without releaser.

Parameters:
  • peer – The native peer pointer.

Methods

equals

public boolean equals(Object object)

Returns true if the peers are pointing to the same memory space.

finalize

protected void finalize()

Invokes the releaser’s Releaser.release(long) method.

getPeer

public long getPeer()

Returns the native pointer.

Returns:The native peer pointer.

hasReleaser

public boolean hasReleaser()

Return true if the pointer has a releaser.

Returns:true when releaser is set

setPeer

public void setPeer(long peer)

Sets the native pointer.

Parameters:
  • peer – The native peer pointer.