Top Description Inners Fields Methods
org.lwjgl.system

public Interface Pointer

Known Direct Subinterfaces
org.lwjgl.system.SharedLibrary, org.lwjgl.system.CallbackI
Known Direct Implementers
org.lwjgl.system.Pointer.Default, org.lwjgl.system.Callback
Imports
org.lwjgl.*, javax.annotation.*, java.nio.*

Pointer interface.

LWJGL can run on both 32bit and 64bit architectures. Since LWJGL applications deal with native memory directly, this interface provides necessary information about the underlying architecture of the running JVM process.

When interacting with native functions, pointer values are mapped to Java long. LWJGL automatically converts long values to the correct pointer addresses when used in native code. Native functions sometimes require arrays of pointer values; the PointerBuffer class may be used for that purpose. It has an API similar to a java.nio.LongBuffer but handles pointer casts automatically.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
Pointer.Default

Default Pointer implementation.

Field Summary

Modifier and TypeField and Description
public static final boolean
BITS32

Will be true on a 32bit JVM.

public static final boolean
BITS64

Will be true on a 64bit JVM.

public static final int
CLONG_SHIFT

The value of sizeof(long) as a power-of-two.

public static final int
CLONG_SIZE

The value of sizeof(long) for the current platform.

public static final int
POINTER_SHIFT

The pointer size power-of-two.

public static final int
POINTER_SIZE

The pointer size in bytes.

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

the pointer address
address
()

Returns the raw pointer address as a long value.

Field Detail

BITS32back to summary
public static final boolean BITS32

Will be true on a 32bit JVM.

BITS64back to summary
public static final boolean BITS64

Will be true on a 64bit JVM.

CLONG_SHIFTback to summary
public static final int CLONG_SHIFT

The value of sizeof(long) as a power-of-two.

CLONG_SIZEback to summary
public static final int CLONG_SIZE

The value of sizeof(long) for the current platform.

POINTER_SHIFTback to summary
public static final int POINTER_SHIFT

The pointer size power-of-two. Will be 2 on a 32bit JVM and 3 on a 64bit one.

POINTER_SIZEback to summary
public static final int POINTER_SIZE

The pointer size in bytes. Will be 4 on a 32bit JVM and 8 on a 64bit one.

Method Detail

addressback to summary
public long address()

Returns the raw pointer address as a long value.

Returns:long

the pointer address

org.lwjgl.system back to summary

public abstract Class Pointer.Default

extends Object
implements Pointer
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.Pointer
Known Direct Subclasses
org.lwjgl.system.SharedLibrary.Default, org.lwjgl.system.Struct, org.lwjgl.system.CustomBuffer, org.lwjgl.system.MemoryStack

Default Pointer implementation.

Field Summary

Modifier and TypeField and Description
protected static final long
protected long
protected static final long
protected static final long
protected static final long
protected static final long
protected static final long
protected static final Unsafe

Constructor Summary

AccessConstructor and Description
protected
Default(long address)

Method Summary

Modifier and TypeMethod and Description
public long
address()

Implements org.lwjgl.system.Pointer.address.

Returns the raw pointer address as a long value.
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

ADDRESSback to summary
protected static final long ADDRESS
addressback to summary
protected long address
BUFFER_CAPACITYback to summary
protected static final long BUFFER_CAPACITY
BUFFER_CONTAINERback to summary
protected static final long BUFFER_CONTAINER
BUFFER_LIMITback to summary
protected static final long BUFFER_LIMIT
BUFFER_MARKback to summary
protected static final long BUFFER_MARK
BUFFER_POSITIONback to summary
protected static final long BUFFER_POSITION
UNSAFEback to summary
protected static final Unsafe UNSAFE

Constructor Detail

Defaultback to summary
protected Default(long address)

Method Detail

addressback to summary
public long address()

Implements org.lwjgl.system.Pointer.address.

Doc from org.lwjgl.system.Pointer.address.

Returns the raw pointer address as a long value.

Returns:long

the pointer address

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override