Package jnr.ffi
Class Platform
- java.lang.Object
-
- jnr.ffi.Platform
-
- Direct Known Subclasses:
Platform.Supported
,Platform.Unsupported
public abstract class Platform extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Platform.CPU
The supported CPU architectures.private static class
Platform.Darwin
APlatform
subclass representing the MacOS system.private static class
Platform.Default
(package private) static class
Platform.Linux
APlatform
subclass representing the Linux operating system.static class
Platform.OS
The common names of supported operating systems.private static class
Platform.SingletonHolder
private static class
Platform.Supported
private static class
Platform.Unsupported
private static class
Platform.Windows
APlatform
subclass representing the Windows system.
-
Field Summary
Fields Modifier and Type Field Description private int
addressSize
private Platform.CPU
cpu
protected java.util.regex.Pattern
libPattern
private static java.util.Locale
LOCALE
private int
longSize
private Platform.OS
os
-
Constructor Summary
Constructors Modifier Constructor Description private
Platform(Platform.OS os)
Platform(Platform.OS os, Platform.CPU cpu, int addressSize, int longSize, java.lang.String libPattern)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
addressSize()
Deprecated.UseRuntime.addressSize()
instead.private static int
calculateAddressSize(Platform.CPU cpu)
private static Platform.CPU
determineCPU()
private static Platform.OS
determineOS()
Determines the operating system jffi is running onprivate static Platform
determinePlatform()
private static Platform
determinePlatform(Platform.OS os)
Determines the Platform that best describes the OSprivate static boolean
equalsIgnoreCase(java.lang.String s1, java.lang.String s2)
Platform.CPU
getCPU()
Gets the current processor architecture the JVM is running on.java.lang.String
getName()
Gets the name of this Platform.static Platform
getNativePlatform()
Gets the native PlatformPlatform.OS
getOS()
Gets the current Operating System.static Platform
getPlatform()
Deprecated.java.lang.String
getStandardCLibraryName()
Returns the platform specific standard C library nameboolean
isBSD()
boolean
isUnix()
java.lang.String
locateLibrary(java.lang.String libName, java.util.List<java.lang.String> libraryPath)
Searches through a list of directories for a native library.int
longSize()
Deprecated.UseRuntime.longSize()
instead.java.lang.String
mapLibraryName(java.lang.String libName)
Maps from a generic library name (e.g.private static boolean
startsWithIgnoreCase(java.lang.String s1, java.lang.String s2)
-
-
-
Field Detail
-
LOCALE
private static final java.util.Locale LOCALE
-
os
private final Platform.OS os
-
cpu
private final Platform.CPU cpu
-
addressSize
private final int addressSize
-
longSize
private final int longSize
-
libPattern
protected final java.util.regex.Pattern libPattern
-
-
Constructor Detail
-
Platform
public Platform(Platform.OS os, Platform.CPU cpu, int addressSize, int longSize, java.lang.String libPattern)
-
Platform
private Platform(Platform.OS os)
-
-
Method Detail
-
determineOS
private static Platform.OS determineOS()
Determines the operating system jffi is running on- Returns:
- An member of the OS enum.
-
determinePlatform
private static Platform determinePlatform(Platform.OS os)
Determines the Platform that best describes the OS- Parameters:
os
- The operating system.- Returns:
- An instance of Platform
-
determinePlatform
private static Platform determinePlatform()
-
determineCPU
private static Platform.CPU determineCPU()
-
calculateAddressSize
private static int calculateAddressSize(Platform.CPU cpu)
-
getNativePlatform
public static Platform getNativePlatform()
Gets the native Platform- Returns:
- The current platform.
-
getPlatform
@Deprecated public static Platform getPlatform()
Deprecated.
-
getOS
public final Platform.OS getOS()
Gets the current Operating System.- Returns:
- A OS value representing the current Operating System.
-
getCPU
public final Platform.CPU getCPU()
Gets the current processor architecture the JVM is running on.- Returns:
- A CPU value 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
public java.lang.String getName()
Gets the name of this Platform.- Returns:
- The name of this platform.
-
getStandardCLibraryName
public java.lang.String getStandardCLibraryName()
Returns the platform specific standard C library name- Returns:
- The standard C library name
-
mapLibraryName
public java.lang.String mapLibraryName(java.lang.String libName)
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
public java.lang.String locateLibrary(java.lang.String libName, java.util.List<java.lang.String> libraryPath)
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
-
startsWithIgnoreCase
private static boolean startsWithIgnoreCase(java.lang.String s1, java.lang.String s2)
-
equalsIgnoreCase
private static boolean equalsIgnoreCase(java.lang.String s1, java.lang.String s2)
-
-