com.kenai.jaffl

Class Platform

public abstract class Platform extends Object

Nested Class Summary
static classPlatform.CPU
The common names of cpu architectures.
static classPlatform.OS
The common names of operating systems.
Field Summary
protected PatternlibPattern
Method Summary
longaddressMask()
Gets the 32/64bit mask of a C address/pointer on the native platform.
intaddressSize()
Gets the size of a C address/pointer on the native platform.
Platform.CPUgetCPU()
Gets the current processor architecture the JVM is running on.
intgetJavaMajorVersion()
Gets the version of the Java Virtual Machine (JVM) jffi is running on.
StringgetName()
Gets the name of this Platform.
Platform.OSgetOS()
Gets the current Operating System.
static PlatformgetPlatform()
Gets the current Platform
booleanisBSD()
booleanisUnix()
StringlocateLibrary(String libName, List<String> libraryPath)
Searches through a list of directories for a native library.
intlongSize()
Gets the size of a C 'long' on the native platform.
StringmapLibraryName(String libName)
Maps from a generic library name (e.g.

Field Detail

libPattern

protected final Pattern libPattern

Method Detail

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

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

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.

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

getName

public String getName()
Gets the name of this Platform.

Returns: The name of this platform.

getOS

public final Platform.OS getOS()
Gets the current Operating System.

Returns: A OS value representing the current Operating System.

getPlatform

public static final Platform getPlatform()
Gets the current Platform

Returns: The current platform.

isBSD

public final boolean isBSD()

isUnix

public final boolean isUnix()

locateLibrary

public String locateLibrary(String libName, List<String> libraryPath)
Searches through a list of directories for a native library.

Parameters: libName the base name (e.g. "c") of the library to locate libraryPath the list of directories to search

Returns: the path of the library

longSize

public final int longSize()
Gets the size of a C 'long' on the native platform.

Returns: the size of a long in bits

mapLibraryName

public String mapLibraryName(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.