Top Inners Fields Constructors Methods
jnr.ffi.provider.jffi

public final Class NativeRuntime

extends AbstractRuntime
Class Inheritance
Imports
jnr.ffi.NativeType, .ObjectReferenceManager, .Platform, .Runtime, .Type, .TypeAlias, jnr.ffi.mapper.DefaultTypeMapper, .SignatureTypeMapperAdapter, jnr.ffi.provider.AbstractRuntime, .BadType, .DefaultObjectReferenceManager, java.lang.reflect.Field, java.nio.ByteOrder, java.util.ArrayList, .Arrays, .Collections, .EnumMap, .EnumSet, .List, .Map, .WeakHashMap, java.util.logging.Level, .Logger

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final Type[]
private final NativeClosureManager
pack-priv final WeakHashMap<NativeLibrary, NativeLibrary.LoadedLibraryData>
private final NativeMemoryManager

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static NativeType[]
private static EnumMap<NativeType, Type>
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 Type
findType(TypeAlias
the type alias.
type
)

Implements abstract jnr.ffi.Runtime.findType.

Looks up the runtime-specific type that corresponds to the type alias
public NativeClosureManager
getClosureManager()

Implements abstract jnr.ffi.Runtime.getClosureManager.

Gets the native closure manager for this runtime
public static NativeRuntime
public int
getLastError()

Implements abstract jnr.ffi.provider.AbstractRuntime.getLastError.

Gets the last native error code.
public static List<NativeLibrary.LoadedLibraryData>
getLoadedLibraries()

Hides jnr.ffi.Runtime.getLoadedLibraries.

See and use Runtime#getLoadedLibraries() (which forwards here) instead of this directly
public final NativeMemoryManager
getMemoryManager()

Implements abstract jnr.ffi.provider.AbstractRuntime.getMemoryManager.

Gets the native memory manager instance for this runtime
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean
isCompatible(Runtime
the other runtime to test for compatibility
other
)

Implements abstract jnr.ffi.Runtime.isCompatible.

Indicates whether this Runtime instance is compatible with another Runtime instance.
private static Type
public ObjectReferenceManager<T>
newObjectReferenceManager()

Implements abstract jnr.ffi.Runtime.newObjectReferenceManager.

Creates a new ObjectReferenceManager
public void
setLastError(int
The value to set errno to.
error
)

Implements abstract jnr.ffi.provider.AbstractRuntime.setLastError.

Sets the native error code.
Inherited from jnr.ffi.provider.AbstractRuntime:
addressMaskaddressSizebyteOrderfindTypelongSize

Field Detail

aliasesback to summary
private final Type[] aliases
closureManagerback to summary
private final NativeClosureManager closureManager
loadedLibrariesback to summary
pack-priv final WeakHashMap<NativeLibrary, NativeLibrary.LoadedLibraryData> loadedLibraries
mmback to summary
private final NativeMemoryManager mm

Constructor Detail

NativeRuntimeback to summary
private NativeRuntime()

Method Detail

buildNativeTypeAliasesback to summary
private static NativeType[] buildNativeTypeAliases()
buildTypeMapback to summary
private static EnumMap<NativeType, Type> buildTypeMap()
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.

Annotations
@Override
findTypeback to summary
public Type findType(TypeAlias type)

Implements abstract jnr.ffi.Runtime.findType.

Doc from jnr.ffi.Runtime.findType.

Looks up the runtime-specific type that corresponds to the type alias

Parameters
type:TypeAlias

the type alias.

Returns:Type

A Type instance

Annotations
@Override
getClosureManagerback to summary
public NativeClosureManager getClosureManager()

Implements abstract jnr.ffi.Runtime.getClosureManager.

Doc from jnr.ffi.Runtime.getClosureManager.

Gets the native closure manager for this runtime

Returns:NativeClosureManager

The ClosureManager of the runtime

getInstanceback to summary
public static NativeRuntime getInstance()
getLastErrorback to summary
public int getLastError()

Implements abstract jnr.ffi.provider.AbstractRuntime.getLastError.

Doc from jnr.ffi.provider.AbstractRuntime.getLastError.

Gets the last native error code.

This returns the errno value that was set at the time of the last native function call.

Returns:int

The errno value.

Annotations
@Override
getLoadedLibrariesback to summary
public static List<NativeLibrary.LoadedLibraryData> getLoadedLibraries()

Hides jnr.ffi.Runtime.getLoadedLibraries.

See and use Runtime#getLoadedLibraries() (which forwards here) instead of this directly

Returns:List<NativeLibrary.LoadedLibraryData>

Doc from jnr.ffi.Runtime.getLoadedLibraries.

the list of NativeLibrary.LoadedLibraryData which represents all currently loaded libraries

getMemoryManagerback to summary
public final NativeMemoryManager getMemoryManager()

Implements abstract jnr.ffi.provider.AbstractRuntime.getMemoryManager.

Doc from jnr.ffi.provider.AbstractRuntime.getMemoryManager.

Gets the native memory manager instance for this runtime

Returns:NativeMemoryManager

a MemoryManager

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

Annotations
@Override
isCompatibleback to summary
public boolean isCompatible(Runtime other)

Implements abstract jnr.ffi.Runtime.isCompatible.

Doc from jnr.ffi.Runtime.isCompatible.

Indicates whether this Runtime instance is compatible with another Runtime instance.

This is not the same as calling equals - this method only indicates whether or not artifacts from the runtime (e.g. memory addresses) are compatible with artifacts from this one.

This is mostly for internal use.

Parameters
other:Runtime

the other runtime to test for compatibility

Returns:boolean

true if the other runtime is compatible with this one

Annotations
@Override
jafflTypeback to summary
private static Type jafflType(NativeType type)
newObjectReferenceManagerback to summary
public ObjectReferenceManager<T> newObjectReferenceManager()

Implements abstract jnr.ffi.Runtime.newObjectReferenceManager.

Doc from jnr.ffi.Runtime.newObjectReferenceManager.

Creates a new ObjectReferenceManager

Returns:ObjectReferenceManager<T>

A new ObjectReferenceManager

Annotations
@Override
setLastErrorback to summary
public void setLastError(int error)

Implements abstract jnr.ffi.provider.AbstractRuntime.setLastError.

Doc from jnr.ffi.provider.AbstractRuntime.setLastError.

Sets the native error code.

Parameters
error:int

The value to set errno to.

Annotations
@Override
jnr.ffi.provider.jffi back to summary

private final Class NativeRuntime.SingletonHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final NativeRuntime

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final NativeRuntime INSTANCE

Constructor Detail

SingletonHolderback to summary
private SingletonHolder()
jnr.ffi.provider.jffi back to summary

private final Class NativeRuntime.TypeDelegate

extends Type
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final NativeType
private final Type

Constructor Summary

AccessConstructor and Description
public
TypeDelegate(Type type, NativeType nativeType)

Method Summary

Modifier and TypeMethod and Description
public int
alignment()

Implements abstract jnr.ffi.Type.alignment.

The native alignment of this type, in bytes
public NativeType
getNativeType()

Implements abstract jnr.ffi.Type.getNativeType.

The native type of this type
public int
size()

Implements abstract jnr.ffi.Type.size.

The size in bytes of this type.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

nativeTypeback to summary
private final NativeType nativeType
typeback to summary
private final Type type

Constructor Detail

TypeDelegateback to summary
public TypeDelegate(Type type, NativeType nativeType)

Method Detail

alignmentback to summary
public int alignment()

Implements abstract jnr.ffi.Type.alignment.

Doc from jnr.ffi.Type.alignment.

The native alignment of this type, in bytes

Returns:int

An integer

getNativeTypeback to summary
public NativeType getNativeType()

Implements abstract jnr.ffi.Type.getNativeType.

Doc from jnr.ffi.Type.getNativeType.

The native type of this type

Returns:NativeType

the native type of this type

sizeback to summary
public int size()

Implements abstract jnr.ffi.Type.size.

Doc from jnr.ffi.Type.size.

The size in bytes of this type.

Returns:int

An integer

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