java.lang.Object
jnr.ffi.Platform
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe supported CPU architectures.static enumThe common names of supported operating systems. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPlatform(Platform.OS os, Platform.CPU cpu, int addressSize, int longSize, String libPattern) -
Method Summary
Modifier and TypeMethodDescriptionfinal intDeprecated.final Platform.CPUgetCPU()Gets the current processor architecture the JVM is running on.getName()Gets the name of thisPlatform.static PlatformGets the nativePlatformfinal Platform.OSgetOS()Gets the current Operating System.static PlatformDeprecated.Returns the platform specific standard C library namefinal booleanisBSD()final booleanisUnix()libraryLocations(String libName, List<String> additionalPaths) Returns a list of absolute paths to the found locations of a library with the base namelibName, if the returned list is empty then the library could not be found and will fail to be loaded as a result.locateLibrary(String libName, List<String> libraryPath) Searches through a list of directories for a native library.final intlongSize()Deprecated.UseRuntime.longSize()instead.mapLibraryName(String libName) Maps from a generic library name (e.g.
-
Field Details
-
libPattern
-
-
Constructor Details
-
Platform
-
-
Method Details
-
getNativePlatform
Gets the nativePlatform- Returns:
- The current platform.
-
getPlatform
Deprecated. -
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.
-
isBSD
public final boolean isBSD() -
isUnix
public final boolean isUnix() -
longSize
public final int longSize()Deprecated.UseRuntime.longSize()instead.Gets the size of a C 'long' on the native platform.- Returns:
- the size of a long in bits
-
addressSize
public final int addressSize()Deprecated.UseRuntime.addressSize()instead.Gets the size 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.
-
getStandardCLibraryName
Returns the platform specific standard C library name- Returns:
- The standard C library name
-
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.
-
locateLibrary
Searches through a list of directories for a native library.- Parameters:
libName- the base name (e.g. "c") of the library to locatelibraryPath- the list of directories to search- Returns:
- the path of the library
-
libraryLocations
Returns a list of absolute paths to the found locations of a library with the base namelibName, if the returned list is empty then the library could not be found and will fail to be loaded as a result. Even if a library is found, this does not guarantee that it will successfully be loaded, it only guarantees that the reason for the failure was not that it was not found.- Parameters:
libName- the base name (e.g. "c") of the library to locateadditionalPaths- additional paths to search, these take precedence over default paths, (as is the behavior inLibraryLoader) pass null to only search in the default paths- Returns:
- the list of absolute paths where the library was found
-
Runtime.addressSize()instead.