jnr.ffi.provider
Class IntPointer

java.lang.Object
  extended by jnr.ffi.Pointer
      extended by jnr.ffi.provider.AbstractMemoryIO
          extended by jnr.ffi.provider.InAccessibleMemoryIO
              extended by jnr.ffi.provider.IntPointer

public final class IntPointer
extends InAccessibleMemoryIO


Constructor Summary
IntPointer(Runtime runtime, int address)
           
IntPointer(Runtime runtime, long address)
           
 
Method Summary
 long address()
          Gets the native address of this memory object (optional operation).
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isDirect()
          Indicates whether or not this memory object represents a native memory address.
 long size()
          Gets the size of this memory object (optional operation).
 
Methods inherited from class jnr.ffi.provider.InAccessibleMemoryIO
array, arrayLength, arrayOffset, error, get, get, get, get, get, get, getByte, getDouble, getFloat, getInt, getLong, getLongLong, getPointer, getPointer, getShort, getString, getString, hasArray, indexOf, put, put, put, put, put, put, putByte, putDouble, putFloat, putInt, putLong, putLongLong, putPointer, putShort, putString, setMemory
 
Methods inherited from class jnr.ffi.provider.AbstractMemoryIO
checkBounds, checkBounds, getAddress, getInt, getNativeLong, getRuntime, indexOf, putAddress, putAddress, putInt, putNativeLong, slice, slice, transferFrom, transferTo
 
Methods inherited from class jnr.ffi.Pointer
newIntPointer, wrap, wrap, wrap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntPointer

public IntPointer(Runtime runtime,
                  long address)

IntPointer

public IntPointer(Runtime runtime,
                  int address)
Method Detail

isDirect

public boolean isDirect()
Description copied from class: Pointer
Indicates whether or not this memory object represents a native memory address.

Memory objects can be either direct (representing native memory), or non-direct (representing java heap memory).

Non-direct memory objects can still be passed to native functions as pointer (void *, char *, etc) parameters, but the java memory will first be copied to a temporary native memory area. The temporary memory area will then be used as the parameter value for the call. If needed, the java memory will be automatically reloaded from the temporary native memory after the native function returns.

Note: the transient nature of the temporary memory allocated for non-direct memory means native functions which store the address value passed to them will fail in unpredictable ways when using non-direct memory. You will need to explicitly allocate direct memory to use those types of functions.

Specified by:
isDirect in class Pointer
Returns:
true if, and only if, this memory object represents a native address.

address

public long address()
Description copied from class: Pointer
Gets the native address of this memory object (optional operation).

Specified by:
address in class Pointer
Returns:
the native address of this memory object. If this object is not a native memory address, an address of zero is returned.

size

public long size()
Description copied from class: Pointer
Gets the size of this memory object (optional operation).

Specified by:
size in class Pointer
Returns:
the size of the memory area this Pointer points to. If the size is unknown, Long.MAX_VALUE is returned}.

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


Copyright © 2012. All Rights Reserved.