Package jnr.ffi.provider.jffi
Class NativeRuntime
- java.lang.Object
-
- jnr.ffi.Runtime
-
- jnr.ffi.provider.AbstractRuntime
-
- jnr.ffi.provider.jffi.NativeRuntime
-
public final class NativeRuntime extends AbstractRuntime
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
NativeRuntime.SingletonHolder
private static class
NativeRuntime.TypeDelegate
-
Field Summary
Fields Modifier and Type Field Description private Type[]
aliases
private NativeClosureManager
closureManager
private NativeMemoryManager
mm
-
Constructor Summary
Constructors Modifier Constructor Description private
NativeRuntime()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static NativeType[]
buildNativeTypeAliases()
private static java.util.EnumMap<NativeType,Type>
buildTypeMap()
boolean
equals(java.lang.Object o)
Type
findType(TypeAlias type)
Looks up the runtime-specific type that corresponds to the type aliasNativeClosureManager
getClosureManager()
Gets the native closure manager for this runtimestatic NativeRuntime
getInstance()
int
getLastError()
Gets the last native error code.NativeMemoryManager
getMemoryManager()
Gets the native memory manager instance for this runtimeint
hashCode()
boolean
isCompatible(Runtime other)
Indicates whether this Runtime instance is compatible with another Runtime instance.private static Type
jafflType(NativeType type)
ObjectReferenceManager
newObjectReferenceManager()
Creates a newObjectReferenceManager
void
setLastError(int error)
Sets the native error code.-
Methods inherited from class jnr.ffi.provider.AbstractRuntime
addressMask, addressSize, byteOrder, findType, longSize
-
Methods inherited from class jnr.ffi.Runtime
getRuntime, getSystemRuntime
-
-
-
-
Field Detail
-
mm
private final NativeMemoryManager mm
-
closureManager
private final NativeClosureManager closureManager
-
aliases
private final Type[] aliases
-
-
Method Detail
-
getInstance
public static NativeRuntime getInstance()
-
buildTypeMap
private static java.util.EnumMap<NativeType,Type> buildTypeMap()
-
buildNativeTypeAliases
private static NativeType[] buildNativeTypeAliases()
-
findType
public Type findType(TypeAlias type)
Description copied from class:Runtime
Looks up the runtime-specific type that corresponds to the type alias
-
getMemoryManager
public final NativeMemoryManager getMemoryManager()
Description copied from class:AbstractRuntime
Gets the native memory manager instance for this runtime- Specified by:
getMemoryManager
in classAbstractRuntime
- Returns:
- a
MemoryManager
-
getClosureManager
public NativeClosureManager getClosureManager()
Description copied from class:Runtime
Gets the native closure manager for this runtime- Specified by:
getClosureManager
in classRuntime
- Returns:
- The
ClosureManager
of the runtime
-
newObjectReferenceManager
public ObjectReferenceManager newObjectReferenceManager()
Description copied from class:Runtime
Creates a newObjectReferenceManager
- Specified by:
newObjectReferenceManager
in classRuntime
- Returns:
- A new
ObjectReferenceManager
-
getLastError
public int getLastError()
Description copied from class:AbstractRuntime
Gets the last native error code.This returns the errno value that was set at the time of the last native function call.
- Specified by:
getLastError
in classAbstractRuntime
- Returns:
- The errno value.
-
setLastError
public void setLastError(int error)
Description copied from class:AbstractRuntime
Sets the native error code.- Specified by:
setLastError
in classAbstractRuntime
- Parameters:
error
- The value to set errno to.
-
isCompatible
public boolean isCompatible(Runtime other)
Description copied from class:Runtime
Indicates whether this Runtime instance is compatible with another Runtime instance.This is not the same as calling
Object.equals(java.lang.Object)
- 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.
- Specified by:
isCompatible
in classRuntime
- Parameters:
other
- the other runtime to test for compatibility- Returns:
- true if the other runtime is compatible with this one
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
jafflType
private static Type jafflType(NativeType type)
-
-