jnr.ffi.provider
Class NullMemoryIO

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.NullMemoryIO

public final class NullMemoryIO
extends InAccessibleMemoryIO


Constructor Summary
NullMemoryIO(Runtime runtime)
           
 
Method Summary
 long address()
          Gets the native address of this memory object (optional operation).
protected  java.lang.NullPointerException error()
           
 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, 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullMemoryIO

public NullMemoryIO(Runtime runtime)
Method Detail

error

protected final java.lang.NullPointerException error()
Overrides:
error in class InAccessibleMemoryIO

isDirect

public final 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}.


Copyright © 2012. All Rights Reserved.