Class Platform
java.lang.Object
com.kenai.jffi.Platform
- Direct Known Subclasses:
Platform.Darwin, Platform.Default, Platform.Windows
Convenience class to interrogate the system about various platform-specific details.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classstatic enumThe common names of cpu architectures.private static final classAPlatformsubclass representing the MacOS system.private static final classstatic enumThe common names of operating systems.private static final classHolds a single, lazily loaded instance ofPlatformprivate static final classAPlatformsubclass representing the Windows system. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate static final Localeprivate final Platform.OS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePlatform(Platform.OS os) Constructs a newPlatforminstance. -
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.private static final Platform.OSDetermines the operating system jffi is running onprivate static final PlatformDetermines thePlatformthat best describes theOSfinal 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.private static Platformprivate static Platformprivate static Platformprivate static booleanstartsWithIgnoreCase(String s1, String s2)
-
Field Details
-
LOCALE
-
os
-
javaVersionMajor
private final int javaVersionMajor
-
-
Constructor Details
-
Platform
Constructs a newPlatforminstance.- Parameters:
os- The current operating system.
-
-
Method Details
-
determineOS
Determines the operating system jffi is running on- Returns:
- An member of the
OSenum.
-
determinePlatform
Determines thePlatformthat best describes theOS- Parameters:
os- The operating system.- Returns:
- An instance of
Platform
-
newDarwinPlatform
-
newWindowsPlatform
-
newDefaultPlatform
-
getPlatform
-
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
-
mapLibraryName
-
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.
-
startsWithIgnoreCase
-