Top Description Inners Fields Constructors Methods
com.kenai.jffi

public abstract Class Platform

extends Object
Class Inheritance
Known Direct Subclasses
com.kenai.jffi.Platform.Default, com.kenai.jffi.Platform.Darwin, com.kenai.jffi.Platform.Windows

Convenience class to interrogate the system about various platform-specific details.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static enum
Platform.CPU

The common names of cpu architectures

Note

The names of the enum values are used in other parts of the code to determine where to find the native stub library.

private static class
Platform.Darwin

A Platform subclass representing the MacOS system.

private static class
public static enum
Platform.OS

The common names of operating systems

Note

The names of the enum values are used in other parts of the code to determine where to find the native stub library.

private static class
Platform.SingletonHolder

Holds a single, lazily loaded instance of Platform

private static class
Platform.Windows

A Platform subclass representing the Windows system.

Field Summary

Modifier and TypeField and Description
private final int
private static final Locale
private final Platform.OS

Constructor Summary

AccessConstructor and Description
private
Platform(Platform.OS
The current operating system.
os
)

Constructs a new Platform instance.

Method Summary

Modifier and TypeMethod and Description
public final long

Returns:

the size of a pointer in bits
addressMask
()

Gets the 32/64bit mask of a C address/pointer on the native platform.

public final int

Returns:

the size of a pointer in bits
addressSize
()

Gets the size of a C address/pointer on the native platform.

private static final Platform.OS

Returns:

An member of the OS enum.
determineOS
()

Determines the operating system jffi is running on

private static final Platform

Returns:

An instance of Platform
determinePlatform
(Platform.OS
The operating system.
os
)

Determines the Platform that best describes the OS

public final Platform.CPU

Returns:

A CPU value representing the current processor architecture.
getCPU
()

Gets the current processor architecture the JVM is running on.

public final int

Returns:

A number representing the java version. e.g. 5 for java 1.5, 6 for java 1.6
getJavaMajorVersion
()

Gets the version of the Java Virtual Machine (JVM) jffi is running on.

public String
getLibraryNamePattern()

Gets the regex string used to match platform-specific libraries

public String

Returns:

The name of this platform.
getName
()

Gets the name of this Platform.

public final Platform.OS

Returns:

A OS value representing the current Operating System.
getOS
()

Gets the current Operating System.

public static final Platform

Returns:

The current platform.
getPlatform
()

Gets the current Platform

public boolean

Returns:

true if the platform is supported, else false.
isSupported
()

Checks if the current platform is supported by JFFI.

public abstract int

Returns:

the size of a long in bits
longSize
()

Gets the size of a C 'long' on the native platform.

public String

Returns:

The mapped library name.
mapLibraryName
(String
The library name to map
libName
)

Maps from a generic library name (e.g. "c") to the platform specific library name.

private static Platform
private static Platform
private static Platform
private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

javaVersionMajorback to summary
private final int javaVersionMajor
LOCALEback to summary
private static final Locale LOCALE
osback to summary
private final Platform.OS os

Constructor Detail

Platformback to summary
private Platform(Platform.OS os)

Constructs a new Platform instance.

Parameters
os:Platform.OS

The current operating system.

Method Detail

addressMaskback to summary
public final long addressMask()

Gets the 32/64bit mask of a C address/pointer on the native platform.

Returns:long

the size of a pointer in bits

addressSizeback to summary
public final int addressSize()

Gets the size of a C address/pointer on the native platform.

Returns:int

the size of a pointer in bits

determineOSback to summary
private static final Platform.OS determineOS()

Determines the operating system jffi is running on

Returns:Platform.OS

An member of the OS enum.

determinePlatformback to summary
private static final Platform determinePlatform(Platform.OS os)

Determines the Platform that best describes the OS

Parameters
os:Platform.OS

The operating system.

Returns:Platform

An instance of Platform

getCPUback to summary
public final Platform.CPU getCPU()

Gets the current processor architecture the JVM is running on.

Returns:Platform.CPU

A CPU value representing the current processor architecture.

getJavaMajorVersionback to summary
public final int getJavaMajorVersion()

Gets the version of the Java Virtual Machine (JVM) jffi is running on.

Returns:int

A number representing the java version. e.g. 5 for java 1.5, 6 for java 1.6

getLibraryNamePatternback to summary
public String getLibraryNamePattern()

Gets the regex string used to match platform-specific libraries

getNameback to summary
public String getName()

Gets the name of this Platform.

Returns:String

The name of this platform.

getOSback to summary
public final Platform.OS getOS()

Gets the current Operating System.

Returns:Platform.OS

A OS value representing the current Operating System.

getPlatformback to summary
public static final Platform getPlatform()

Gets the current Platform

Returns:Platform

The current platform.

isSupportedback to summary
public boolean isSupported()

Checks if the current platform is supported by JFFI.

Returns:boolean

true if the platform is supported, else false.

longSizeback to summary
public abstract int longSize()

Gets the size of a C 'long' on the native platform.

Returns:int

the size of a long in bits

mapLibraryNameback to summary
public String mapLibraryName(String libName)

Maps from a generic library name (e.g. "c") to the platform specific library name.

Parameters
libName:String

The library name to map

Returns:String

The mapped library name.

newDarwinPlatformback to summary
private static Platform newDarwinPlatform()
newDefaultPlatformback to summary
private static Platform newDefaultPlatform(Platform.OS os)
newWindowsPlatformback to summary
private static Platform newWindowsPlatform()
startsWithIgnoreCaseback to summary
private static boolean startsWithIgnoreCase(String s1, String s2)
com.kenai.jffi back to summary

private final Class Platform.ArchHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Platform.CPU

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static Platform.CPU

Returns:

A member of the CPU enum.
determineCPU
()

Determines the CPU architecture the JVM is running on.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cpuback to summary
public static final Platform.CPU cpu

Constructor Detail

ArchHolderback to summary
private ArchHolder()

Method Detail

determineCPUback to summary
private static Platform.CPU determineCPU()

Determines the CPU architecture the JVM is running on. This normalizes all the variations that are equivalent (e.g. i386, x86, i86pc) into a common cpu type.

Returns:Platform.CPU

A member of the CPU enum.

com.kenai.jffi back to summary

public final Enum Platform.CPU

extends Enum<Platform.CPU>
Class Inheritance

The common names of cpu architectures

Note

The names of the enum values are used in other parts of the code to determine where to find the native stub library. Do not rename.

Field Summary

Modifier and TypeField and Description
public static final Platform.CPU
AARCH64

AARCH64

public final long
public static final Platform.CPU
ARM

ARM

public final int
public static final Platform.CPU
I386

Intel ia32

public static final Platform.CPU
MIPS64EL

MIPS64EL

public static final Platform.CPU
PPC

Power PC 32 bit

public static final Platform.CPU
PPC64

Power PC 64 bit

public static final Platform.CPU
PPC64LE

Power PC 64 bit little endian

public static final Platform.CPU
S390X

IBM zSeries S/390 64 bit

public static final Platform.CPU
SPARC

Sun sparc 32 bit

public static final Platform.CPU
SPARCV9

Sun sparc 64 bit

public static final Platform.CPU
UNKNOWN

Unknown CPU

public static final Platform.CPU
X86_64

AMD 64 bit (aka EM64T/X64)

Constructor Summary

AccessConstructor and Description
private
CPU(int dataModel)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration.
public static Platform.CPU
public static Platform.CPU[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

AARCH64back to summary
public static final Platform.CPU AARCH64

AARCH64

addressMaskback to summary
public final long addressMask
ARMback to summary
public static final Platform.CPU ARM

ARM

dataModelback to summary
public final int dataModel
I386back to summary
public static final Platform.CPU I386

Intel ia32

MIPS64ELback to summary
public static final Platform.CPU MIPS64EL

MIPS64EL

PPCback to summary
public static final Platform.CPU PPC

Power PC 32 bit

PPC64back to summary
public static final Platform.CPU PPC64

Power PC 64 bit

PPC64LEback to summary
public static final Platform.CPU PPC64LE

Power PC 64 bit little endian

S390Xback to summary
public static final Platform.CPU S390X

IBM zSeries S/390 64 bit

SPARCback to summary
public static final Platform.CPU SPARC

Sun sparc 32 bit

SPARCV9back to summary
public static final Platform.CPU SPARCV9

Sun sparc 64 bit

UNKNOWNback to summary
public static final Platform.CPU UNKNOWN

Unknown CPU

X86_64back to summary
public static final Platform.CPU X86_64

AMD 64 bit (aka EM64T/X64)

Constructor Detail

CPUback to summary
private CPU(int dataModel)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Doc from java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.

Returns:String

the name of this enum constant

Annotations
@Override
valueOfback to summary
public static Platform.CPU valueOf(String name)
valuesback to summary
public static Platform.CPU[] values()
com.kenai.jffi back to summary

private final Class Platform.Darwin

extends Platform
Class Inheritance

A Platform subclass representing the MacOS system.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getLibraryNamePattern()

Overrides com.kenai.jffi.Platform.getLibraryNamePattern.

Gets the regex string used to match platform-specific libraries
public String
getName()

Overrides com.kenai.jffi.Platform.getName.

Gets the name of this Platform.
public final int
longSize()

Implements abstract com.kenai.jffi.Platform.longSize.

Gets the size of a C 'long' on the native platform.
public String
mapLibraryName(String
The library name to map
libName
)

Overrides com.kenai.jffi.Platform.mapLibraryName.

Maps from a generic library name (e.g. "c") to the platform specific library name.
Inherited from com.kenai.jffi.Platform:
addressMaskaddressSizegetCPUgetJavaMajorVersiongetOSgetPlatformisSupported

Constructor Detail

Darwinback to summary
public Darwin()

Method Detail

getLibraryNamePatternback to summary
public String getLibraryNamePattern()

Overrides com.kenai.jffi.Platform.getLibraryNamePattern.

Doc from com.kenai.jffi.Platform.getLibraryNamePattern.

Gets the regex string used to match platform-specific libraries

Annotations
@Override
getNameback to summary
public String getName()

Overrides com.kenai.jffi.Platform.getName.

Doc from com.kenai.jffi.Platform.getName.

Gets the name of this Platform.

Returns:String

The name of this platform.

Annotations
@Override
longSizeback to summary
public final int longSize()

Implements abstract com.kenai.jffi.Platform.longSize.

Doc from com.kenai.jffi.Platform.longSize.

Gets the size of a C 'long' on the native platform.

Returns:int

the size of a long in bits

mapLibraryNameback to summary
public String mapLibraryName(String libName)

Overrides com.kenai.jffi.Platform.mapLibraryName.

Doc from com.kenai.jffi.Platform.mapLibraryName.

Maps from a generic library name (e.g. "c") to the platform specific library name.

Parameters
libName:String

The library name to map

Returns:String

The mapped library name.

Annotations
@Override
com.kenai.jffi back to summary

private final Class Platform.Default

extends Platform
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final int
longSize()

Implements abstract com.kenai.jffi.Platform.longSize.

Gets the size of a C 'long' on the native platform.
Inherited from com.kenai.jffi.Platform:
addressMaskaddressSizegetCPUgetJavaMajorVersiongetLibraryNamePatterngetNamegetOSgetPlatformisSupportedmapLibraryName

Constructor Detail

Defaultback to summary
public Default(Platform.OS os)

Method Detail

longSizeback to summary
public final int longSize()

Implements abstract com.kenai.jffi.Platform.longSize.

Doc from com.kenai.jffi.Platform.longSize.

Gets the size of a C 'long' on the native platform.

Returns:int

the size of a long in bits

com.kenai.jffi back to summary

public final Enum Platform.OS

extends Enum<Platform.OS>
Class Inheritance

The common names of operating systems

Note

The names of the enum values are used in other parts of the code to determine where to find the native stub library. Do not rename.

Field Summary

Modifier and TypeField and Description
public static final Platform.OS
AIX

IBM AIX

public static final Platform.OS
DARWIN

MacOSX

public static final Platform.OS
DRAGONFLY

DragonFly

public static final Platform.OS
FREEBSD

FreeBSD

public static final Platform.OS
IBMI

IBM i

public static final Platform.OS
LINUX

Linux

public static final Platform.OS
NETBSD

NetBSD

public static final Platform.OS
OPENBSD

OpenBSD

public static final Platform.OS
SOLARIS

Solaris (and OpenSolaris)

public static final Platform.OS
UNKNOWN

No idea what the operating system is

public static final Platform.OS
WINDOWS

The evil borg operating system

public static final Platform.OS
ZLINUX

IBM zOS

Constructor Summary

AccessConstructor and Description
private
OS()

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration.
public static Platform.OS
public static Platform.OS[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

AIXback to summary
public static final Platform.OS AIX

IBM AIX

DARWINback to summary
public static final Platform.OS DARWIN

MacOSX

DRAGONFLYback to summary
public static final Platform.OS DRAGONFLY

DragonFly

FREEBSDback to summary
public static final Platform.OS FREEBSD

FreeBSD

IBMIback to summary
public static final Platform.OS IBMI

IBM i

LINUXback to summary
public static final Platform.OS LINUX

Linux

NETBSDback to summary
public static final Platform.OS NETBSD

NetBSD

OPENBSDback to summary
public static final Platform.OS OPENBSD

OpenBSD

SOLARISback to summary
public static final Platform.OS SOLARIS

Solaris (and OpenSolaris)

UNKNOWNback to summary
public static final Platform.OS UNKNOWN

No idea what the operating system is

WINDOWSback to summary
public static final Platform.OS WINDOWS

The evil borg operating system

ZLINUXback to summary
public static final Platform.OS ZLINUX

IBM zOS

Constructor Detail

OSback to summary
private OS()

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Doc from java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.

Returns:String

the name of this enum constant

Annotations
@Override
valueOfback to summary
public static Platform.OS valueOf(String name)
valuesback to summary
public static Platform.OS[] values()
com.kenai.jffi back to summary

private final Class Platform.SingletonHolder

extends Object
Class Inheritance

Holds a single, lazily loaded instance of Platform

Field Summary

Modifier and TypeField and Description
pack-priv static final Platform

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

PLATFORMback to summary
pack-priv static final Platform PLATFORM

Constructor Detail

SingletonHolderback to summary
private SingletonHolder()
com.kenai.jffi back to summary

private final Class Platform.Windows

extends Platform
Class Inheritance

A Platform subclass representing the Windows system.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getLibraryNamePattern()

Overrides com.kenai.jffi.Platform.getLibraryNamePattern.

Gets the regex string used to match platform-specific libraries
public final int
longSize()

Implements abstract com.kenai.jffi.Platform.longSize.

Gets the size of a C 'long' on the native platform.
Inherited from com.kenai.jffi.Platform:
addressMaskaddressSizegetCPUgetJavaMajorVersiongetNamegetOSgetPlatformisSupportedmapLibraryName

Constructor Detail

Windowsback to summary
public Windows()

Method Detail

getLibraryNamePatternback to summary
public String getLibraryNamePattern()

Overrides com.kenai.jffi.Platform.getLibraryNamePattern.

Doc from com.kenai.jffi.Platform.getLibraryNamePattern.

Gets the regex string used to match platform-specific libraries

Annotations
@Override
longSizeback to summary
public final int longSize()

Implements abstract com.kenai.jffi.Platform.longSize.

Doc from com.kenai.jffi.Platform.longSize.

Gets the size of a C 'long' on the native platform.

Returns:int

the size of a long in bits