org.jruby.ext.ffi
Class Platform

java.lang.Object
  extended by org.jruby.ext.ffi.Platform

public class Platform
extends java.lang.Object


Nested Class Summary
static class Platform.CPU
           
static class Platform.OS
           
 
Field Summary
protected  int addressSize
           
static int BIG_ENDIAN
           
static int BYTE_ORDER
           
static Platform.CPU CPU
           
static java.lang.String LIBC
           
protected  java.util.regex.Pattern libPattern
           
static java.lang.String LIBPREFIX
           
static java.lang.String LIBSUFFIX
           
static int LITTLE_ENDIAN
           
protected  int longSize
           
static java.lang.String NAME
           
static Platform.OS OS
           
 
Constructor Summary
protected Platform(Platform.OS os)
           
 
Method Summary
 long addressMask()
          Gets the 32/64bit mask of a C address/pointer on the native platform.
 int addressSize()
          Gets the size of a C address/pointer on the native platform.
static IRubyObject bsd_p(ThreadContext context, IRubyObject recv)
           
static void createPlatformModule(Ruby runtime, RubyModule ffi)
           
 Platform.CPU getCPU()
          Gets the current processor architecture the JVM is running on.
 int getJavaMajorVersion()
          Gets the version of the Java Virtual Machine (JVM) jffi is running on.
 java.lang.String getName()
          Gets the name of this Platform.
 Platform.OS getOS()
          Gets the current Operating System.
static Platform getPlatform()
          Gets the current Platform
static java.lang.String getProperty(java.lang.String property, java.lang.String defValue)
          An extension over System.getProperty method.
 boolean isBSD()
           
 boolean isSupported()
           
 boolean isUnix()
           
static IRubyObject linux_p(ThreadContext context, IRubyObject recv)
           
 int longSize()
          Gets the size of a C 'long' on the native platform.
static IRubyObject mac_p(ThreadContext context, IRubyObject recv)
           
 java.lang.String mapLibraryName(java.lang.String libName)
           
static IRubyObject solaris_p(ThreadContext context, IRubyObject recv)
           
static IRubyObject unix_p(ThreadContext context, IRubyObject recv)
           
static IRubyObject windows_p(ThreadContext context, IRubyObject recv)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CPU

public static final Platform.CPU CPU

OS

public static final Platform.OS OS

NAME

public static final java.lang.String NAME

LIBC

public static final java.lang.String LIBC

LIBPREFIX

public static final java.lang.String LIBPREFIX

LIBSUFFIX

public static final java.lang.String LIBSUFFIX

BIG_ENDIAN

public static final int BIG_ENDIAN
See Also:
Constant Field Values

LITTLE_ENDIAN

public static final int LITTLE_ENDIAN
See Also:
Constant Field Values

BYTE_ORDER

public static final int BYTE_ORDER

addressSize

protected final int addressSize

longSize

protected final int longSize

libPattern

protected final java.util.regex.Pattern libPattern
Constructor Detail

Platform

protected Platform(Platform.OS os)
Method Detail

getPlatform

public static final Platform getPlatform()
Gets the current Platform

Returns:
The current platform.

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.

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

isBSD

public final boolean isBSD()

isUnix

public final boolean isUnix()

isSupported

public final boolean isSupported()

createPlatformModule

public static void createPlatformModule(Ruby runtime,
                                        RubyModule ffi)

windows_p

public static IRubyObject windows_p(ThreadContext context,
                                    IRubyObject recv)

mac_p

public static IRubyObject mac_p(ThreadContext context,
                                IRubyObject recv)

unix_p

public static IRubyObject unix_p(ThreadContext context,
                                 IRubyObject recv)

bsd_p

public static IRubyObject bsd_p(ThreadContext context,
                                IRubyObject recv)

linux_p

public static IRubyObject linux_p(ThreadContext context,
                                  IRubyObject recv)

solaris_p

public static IRubyObject solaris_p(ThreadContext context,
                                    IRubyObject recv)

getProperty

public static java.lang.String getProperty(java.lang.String property,
                                           java.lang.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 - The system property name.
defValue - The default value.
Returns:
The value of the system property, or the default value.

longSize

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

Returns:
the size of a long 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

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

getName

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

Returns:
The name of this platform.

mapLibraryName

public java.lang.String mapLibraryName(java.lang.String libName)


Copyright © 2002-2009 JRuby Team. All Rights Reserved.