Top Inners Fields Constructors Methods
org.jruby.ext.ffi

public Class Platform

extends Object
Class Inheritance
Known Direct Subclasses
org.jruby.ext.ffi.Platform.Supported, org.jruby.ext.ffi.Platform.Unsupported, org.jruby.ext.ffi.Platform.Default
Imports
java.nio.ByteOrder, java.util.regex.Pattern, org.jruby.RubyModule, org.jruby.anno.JRubyMethod, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.SafePropertyAccessor

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
Platform.AIX

A Platform subclass representing the Linux operating system.

public static enum
private static class
Platform.Darwin

A Platform subclass representing the MacOS system.

private static class
private static class
Platform.Linux

A Platform subclass representing the Linux operating system.

public static enum
private static class
private static class
private static class
private static class
Platform.Windows

A Platform subclass representing the Windows system.

Field Summary

Modifier and TypeField and Description
private final long
protected final int
private static final int
public static final int
public static final int
public static final Platform.CPU_TYPE
public static final String
protected final Pattern
public static final String
public static final String
public static final int
private static final Locale
protected final int
public static final String
public static final Platform.OS_TYPE

Constructor Summary

AccessConstructor and Description
protected

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.

public static IRubyObject
public static void
private static int
private static final Platform.CPU_TYPE
private static final String
private static final String
private static final Platform.OS_TYPE
private static final Platform
public final Platform.CPU_TYPE

Returns:

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

Gets the current processor architecture the JVM is running on.

public final int
getJavaMajorVersion()
Deprecated

public String

Returns:

The name of this platform.
getName
()

Gets the name of this Platform.

public final Platform.OS_TYPE

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 static String

Returns:

The value of the system property, or the default value.
getProperty
(String
The system property name.
property
,
String
The default value.
defValue
)

An extension over System.getProperty method.

public final boolean
public final boolean
public final boolean
public static IRubyObject
public final int

Returns:

the size of a long in bits
longSize
()

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

public static IRubyObject
public String
public static IRubyObject
private static boolean
public static IRubyObject
public static IRubyObject
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressMaskback to summary
private final long addressMask
addressSizeback to summary
protected final int addressSize
ARCH_DATA_MODELback to summary
private static final int ARCH_DATA_MODEL
BIG_ENDIANback to summary
public static final int BIG_ENDIAN
BYTE_ORDERback to summary
public static final int BYTE_ORDER
CPUback to summary
public static final Platform.CPU_TYPE CPU
LIBCback to summary
public static final String LIBC
libPatternback to summary
protected final Pattern libPattern
LIBPREFIXback to summary
public static final String LIBPREFIX
LIBSUFFIXback to summary
public static final String LIBSUFFIX
LITTLE_ENDIANback to summary
public static final int LITTLE_ENDIAN
LOCALEback to summary
private static final Locale LOCALE
longSizeback to summary
protected final int longSize
NAMEback to summary
public static final String NAME
OSback to summary
public static final Platform.OS_TYPE OS

Constructor Detail

Platformback to summary
protected Platform(Platform.OS_TYPE os)

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

bsd_pback to summary
public static IRubyObject bsd_p(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
name:bsd?
module:true
createPlatformModuleback to summary
public static void createPlatformModule(ThreadContext context, RubyModule FFI)
determineArchDataModelback to summary
private static int determineArchDataModel()
determineCPUback to summary
private static final Platform.CPU_TYPE determineCPU()
determineLibCback to summary
private static final String determineLibC()
determineLibExtback to summary
private static final String determineLibExt()
determineOSback to summary
private static final Platform.OS_TYPE determineOS()
determinePlatformback to summary
private static final Platform determinePlatform(Platform.OS_TYPE os)
getCPUback to summary
public final Platform.CPU_TYPE getCPU()

Gets the current processor architecture the JVM is running on.

Returns:Platform.CPU_TYPE

A CPU value representing the current processor architecture.

getJavaMajorVersionback to summary
public final int getJavaMajorVersion()

Deprecated

Annotations
@Deprecated
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_TYPE getOS()

Gets the current Operating System.

Returns:Platform.OS_TYPE

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.

getPropertyback to summary
public static String getProperty(String property, String defValue)

An extension over System.getProperty method. Handles security restrictions, and returns the default value if the access to the property is restricted.

Parameters
property:String

The system property name.

defValue:String

The default value.

Returns:String

The value of the system property, or the default value.

isBSDback to summary
public final boolean isBSD()
isSupportedback to summary
public final boolean isSupported()
isUnixback to summary
public final boolean isUnix()
linux_pback to summary
public static IRubyObject linux_p(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
name:linux?
module:true
longSizeback to summary
public final int longSize()

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

Returns:int

the size of a long in bits

mac_pback to summary
public static IRubyObject mac_p(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
name:mac?
module:true
mapLibraryNameback to summary
public String mapLibraryName(String libName)
solaris_pback to summary
public static IRubyObject solaris_p(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
name:solaris?
module:true
startsWithIgnoreCaseback to summary
private static boolean startsWithIgnoreCase(String s1, String s2)
unix_pback to summary
public static IRubyObject unix_p(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
name:unix?
module:true
windows_pback to summary
public static IRubyObject windows_p(ThreadContext context, IRubyObject recv)
Annotations
@JRubyMethod
name:windows?
module:true
org.jruby.ext.ffi back to summary

private final Class Platform.AIX

extends Supported
Class Inheritance

A Platform subclass representing the Linux operating system.

Constructor Summary

AccessConstructor and Description
public
AIX()

Method Summary

Modifier and TypeMethod and Description
public String

Constructor Detail

AIXback to summary
public AIX()

Method Detail

mapLibraryNameback to summary
public String mapLibraryName(String libName)

Overrides org.jruby.ext.ffi.Platform.mapLibraryName.

Annotations
@Override
org.jruby.ext.ffi back to summary

public final Enum Platform.CPU_TYPE

extends Enum<Platform.CPU_TYPE>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE
public static final Platform.CPU_TYPE

Constructor Summary

AccessConstructor and Description
private

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_TYPE
public static Platform.CPU_TYPE[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

AARCH64back to summary
public static final Platform.CPU_TYPE AARCH64
ARMback to summary
public static final Platform.CPU_TYPE ARM
I386back to summary
public static final Platform.CPU_TYPE I386
LOONGARCH64back to summary
public static final Platform.CPU_TYPE LOONGARCH64
POWERPCback to summary
public static final Platform.CPU_TYPE POWERPC
POWERPC64back to summary
public static final Platform.CPU_TYPE POWERPC64
POWERPC64LEback to summary
public static final Platform.CPU_TYPE POWERPC64LE
S390Xback to summary
public static final Platform.CPU_TYPE S390X
SPARCback to summary
public static final Platform.CPU_TYPE SPARC
SPARCV9back to summary
public static final Platform.CPU_TYPE SPARCV9
UNKNOWNback to summary
public static final Platform.CPU_TYPE UNKNOWN
X86_64back to summary
public static final Platform.CPU_TYPE X86_64

Constructor Detail

CPU_TYPEback to summary
private CPU_TYPE()

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_TYPE valueOf(String name)
valuesback to summary
public static Platform.CPU_TYPE[] values()
org.jruby.ext.ffi back to summary

private final Class Platform.Darwin

extends Supported
Class Inheritance

A Platform subclass representing the MacOS system.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Constructor Detail

Darwinback to summary
public Darwin()

Method Detail

mapLibraryNameback to summary
public String mapLibraryName(String libName)

Overrides org.jruby.ext.ffi.Platform.mapLibraryName.

Annotations
@Override
org.jruby.ext.ffi back to summary

private final Class Platform.Default

extends Platform
Class Inheritance

Field Summary

Inherited from org.jruby.ext.ffi.Platform:
addressSizeBIG_ENDIANBYTE_ORDERCPULIBClibPatternLIBPREFIXLIBSUFFIXLITTLE_ENDIANlongSizeNAMEOS

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.jruby.ext.ffi.Platform:
addressMaskaddressSizebsd_pcreatePlatformModulegetCPUgetJavaMajorVersiongetNamegetOSgetPlatformgetPropertyisBSDisSupportedisUnixlinux_plongSizemac_pmapLibraryNamesolaris_punix_pwindows_p

Constructor Detail

Defaultback to summary
public Default(Platform.OS_TYPE os)
org.jruby.ext.ffi back to summary

private final Class Platform.Linux

extends Supported
Class Inheritance

A Platform subclass representing the Linux operating system.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Constructor Detail

Linuxback to summary
public Linux()

Method Detail

mapLibraryNameback to summary
public String mapLibraryName(String libName)

Overrides org.jruby.ext.ffi.Platform.mapLibraryName.

Annotations
@Override
org.jruby.ext.ffi back to summary

public final Enum Platform.OS_TYPE

extends Enum<Platform.OS_TYPE>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE
public static final Platform.OS_TYPE

Constructor Summary

AccessConstructor and Description
private

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_TYPE
public static Platform.OS_TYPE[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

AIXback to summary
public static final Platform.OS_TYPE AIX
DARWINback to summary
public static final Platform.OS_TYPE DARWIN
DRAGONFLYBSDback to summary
public static final Platform.OS_TYPE DRAGONFLYBSD
FREEBSDback to summary
public static final Platform.OS_TYPE FREEBSD
LINUXback to summary
public static final Platform.OS_TYPE LINUX
NETBSDback to summary
public static final Platform.OS_TYPE NETBSD
OPENBSDback to summary
public static final Platform.OS_TYPE OPENBSD
SOLARISback to summary
public static final Platform.OS_TYPE SOLARIS
UNKNOWNback to summary
public static final Platform.OS_TYPE UNKNOWN
WINDOWSback to summary
public static final Platform.OS_TYPE WINDOWS

Constructor Detail

OS_TYPEback to summary
private OS_TYPE()

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_TYPE valueOf(String name)
valuesback to summary
public static Platform.OS_TYPE[] values()
org.jruby.ext.ffi back to summary

private final Class Platform.SingletonHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final Platform

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

PLATFORMback to summary
private static final Platform PLATFORM

Constructor Detail

SingletonHolderback to summary
private SingletonHolder()
org.jruby.ext.ffi back to summary

private Class Platform.Supported

extends Platform
Class Inheritance
Known Direct Subclasses
org.jruby.ext.ffi.Platform.Darwin, org.jruby.ext.ffi.Platform.Linux, org.jruby.ext.ffi.Platform.AIX, org.jruby.ext.ffi.Platform.Windows

Field Summary

Inherited from org.jruby.ext.ffi.Platform:
addressSizeBIG_ENDIANBYTE_ORDERCPULIBClibPatternLIBPREFIXLIBSUFFIXLITTLE_ENDIANlongSizeNAMEOS

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.jruby.ext.ffi.Platform:
addressMaskaddressSizebsd_pcreatePlatformModulegetCPUgetJavaMajorVersiongetNamegetOSgetPlatformgetPropertyisBSDisSupportedisUnixlinux_plongSizemac_pmapLibraryNamesolaris_punix_pwindows_p

Constructor Detail

Supportedback to summary
public Supported(Platform.OS_TYPE os)
org.jruby.ext.ffi back to summary

private Class Platform.Unsupported

extends Platform
Class Inheritance

Field Summary

Inherited from org.jruby.ext.ffi.Platform:
addressSizeBIG_ENDIANBYTE_ORDERCPULIBClibPatternLIBPREFIXLIBSUFFIXLITTLE_ENDIANlongSizeNAMEOS

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.jruby.ext.ffi.Platform:
addressMaskaddressSizebsd_pcreatePlatformModulegetCPUgetJavaMajorVersiongetNamegetOSgetPlatformgetPropertyisBSDisSupportedisUnixlinux_plongSizemac_pmapLibraryNamesolaris_punix_pwindows_p

Constructor Detail

Unsupportedback to summary
public Unsupported(Platform.OS_TYPE os)
org.jruby.ext.ffi back to summary

private Class Platform.Windows

extends Supported
Class Inheritance

A Platform subclass representing the Windows system.

Constructor Summary

AccessConstructor and Description
public

Constructor Detail

Windowsback to summary
public Windows()