public abstract class Platform extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Platform.CPU
The supported CPU architectures.
|
static class |
Platform.OS
The common names of supported operating systems.
|
Modifier and Type | Field and Description |
---|---|
protected Pattern |
libPattern |
Constructor and Description |
---|
Platform(Platform.OS os,
Platform.CPU cpu,
int addressSize,
int longSize,
String libPattern) |
Modifier and Type | Method and Description |
---|---|
int |
addressSize()
Deprecated.
Use
Runtime.addressSize() instead. |
Platform.CPU |
getCPU()
Gets the current processor architecture the JVM is running on.
|
String |
getName()
Gets the name of this
Platform . |
static Platform |
getNativePlatform()
Gets the native
Platform |
Platform.OS |
getOS()
Gets the current Operating System.
|
String |
getOSName() |
static Platform |
getPlatform()
Deprecated.
|
String |
getStandardCLibraryName()
Returns the platform specific standard C library name
|
String |
getVersion()
Gets the version of this platform as specified by the system property "os.version"
|
int |
getVersionMajor()
Gets the number representing the major version of this platform
This uses the first number from
getVersion() |
int |
getVersionMinor()
Gets the number representing the minor version of this platform
This uses the second number from
getVersion() |
boolean |
is32Bit() |
boolean |
is64Bit() |
boolean |
isBigEndian()
Returns true if the current platform is big endian
|
boolean |
isBSD() |
boolean |
isLittleEndian()
Returns true if the current platform is little endian
|
boolean |
isUnix() |
List<String> |
libraryLocations(String libName,
List<String> additionalPaths)
Returns a list of absolute paths to the found locations of a library with the base name
libName ,
if the returned list is empty then the library could not be found and will fail to be loaded as a result. |
String |
locateLibrary(String libName,
List<String> libraryPath)
Searches through a list of directories for a native library.
|
String |
locateLibrary(String libName,
List<String> libraryPaths,
Map<LibraryOption,Object> options)
Searches through a list of directories for a native library.
|
int |
longSize()
Deprecated.
Use
Runtime.longSize() instead. |
String |
mapLibraryName(String libName)
Maps from a generic library name (e.g.
|
protected final Pattern libPattern
public Platform(Platform.OS os, Platform.CPU cpu, int addressSize, int longSize, String libPattern)
public static Platform getNativePlatform()
Platform
@Deprecated public static Platform getPlatform()
public final Platform.OS getOS()
OS
value representing the current Operating System.public final Platform.CPU getCPU()
CPU
value representing the current processor architecture.public final boolean isBSD()
public final boolean isUnix()
public final int longSize()
Runtime.longSize()
instead.public final int addressSize()
Runtime.addressSize()
instead.public final boolean is32Bit()
Runtime.longSize()
public final boolean is64Bit()
Runtime.longSize()
public final boolean isLittleEndian()
public final boolean isBigEndian()
public final String getOSName()
os.name
or null if none was found
This is not the same as getOS()
which returns the Platform.OS
.
For example: Mac OS X is the Platform.OS.DARWIN
Platform.OS
but returns "Mac OS X" from this methodpublic String getName()
Platform
.public String getVersion()
public int getVersionMajor()
getVersion()
public int getVersionMinor()
getVersion()
public String getStandardCLibraryName()
public String mapLibraryName(String libName)
libName
- The library name to mappublic String locateLibrary(String libName, List<String> libraryPath)
libName
- the base name (e.g. "c") of the library to locatelibraryPath
- the list of directories to searchpublic String locateLibrary(String libName, List<String> libraryPaths, Map<LibraryOption,Object> options)
libName
- the base name (e.g. "c") of the library to locatelibraryPaths
- the list of directories to searchoptions
- map of LibraryOption
s to customize search behavior
such as LibraryOption.PreferCustomPaths
public List<String> libraryLocations(String libName, List<String> additionalPaths)
libName
,
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.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 in LibraryLoader
)
pass null to only search in the default pathsCopyright © 2024. All rights reserved.