Package com.kenai.jffi
Class Platform
java.lang.Object
com.kenai.jffi.Platform
Convenience class to interrogate the system about various platform-specific details.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe common names of cpu architectures.static enumThe common names of operating systems. -
Method Summary
Modifier and TypeMethodDescriptionfinal longGets the 32/64bit mask of a C address/pointer on the native platform.final intGets the size of a C address/pointer on the native platform.final Platform.CPUgetCPU()Gets the current processor architecture the JVM is running on.final intGets the version of the Java Virtual Machine (JVM) jffi is running on.Gets the regex string used to match platform-specific librariesgetName()Gets the name of thisPlatform.final Platform.OSgetOS()Gets the current Operating System.static final PlatformGets the currentPlatformbooleanChecks if the current platform is supported by JFFI.abstract intlongSize()Gets the size of a C 'long' on the native platform.mapLibraryName(String libName) Maps from a generic library name (e.g.
-
Method Details
-
getPlatform
Gets the currentPlatform- Returns:
- The current platform.
-
getOS
Gets the current Operating System.- Returns:
- A
OSvalue representing the current Operating System.
-
getCPU
Gets the current processor architecture the JVM is running on.- Returns:
- A
CPUvalue representing the current processor architecture.
-
getJavaMajorVersion
public final int getJavaMajorVersion()Gets the version of the Java Virtual Machine (JVM) jffi is running on.- Returns:
- A number representing the java version. e.g. 5 for java 1.5, 6 for java 1.6
-
longSize
public abstract int longSize()Gets the size of a C 'long' on the native platform.- Returns:
- the size of a long in bits
-
addressSize
public final int addressSize()Gets the size of a C address/pointer on the native platform.- Returns:
- the size of a pointer in bits
-
addressMask
public final long addressMask()Gets the 32/64bit mask of a C address/pointer on the native platform.- Returns:
- the size of a pointer in bits
-
getName
Gets the name of thisPlatform.- Returns:
- The name of this platform.
-
mapLibraryName
Maps from a generic library name (e.g. "c") to the platform specific library name.- Parameters:
libName- The library name to map- Returns:
- The mapped library name.
-
getLibraryNamePattern
Gets the regex string used to match platform-specific libraries- Returns:
-
isSupported
public boolean isSupported()Checks if the current platform is supported by JFFI.- Returns:
trueif the platform is supported, else false.
-