Class Platform

java.lang.Object
org.jruby.ext.ffi.Platform
Direct Known Subclasses:
Platform.Default, Platform.Supported, Platform.Unsupported

public class Platform extends Object
  • Field Details

    • LOCALE

      private static final Locale LOCALE
    • CPU

      public static final Platform.CPU_TYPE CPU
    • OS

      public static final Platform.OS_TYPE OS
    • ARCH_DATA_MODEL

      private static final int ARCH_DATA_MODEL
    • NAME

      public static final String NAME
    • LIBPREFIX

      public static final String LIBPREFIX
    • LIBSUFFIX

      public static final String LIBSUFFIX
    • LIBC

      public static final String LIBC
    • BIG_ENDIAN

      public static final int BIG_ENDIAN
      See Also:
    • LITTLE_ENDIAN

      public static final int LITTLE_ENDIAN
      See Also:
    • BYTE_ORDER

      public static final int BYTE_ORDER
    • addressSize

      protected final int addressSize
    • longSize

      protected final int longSize
    • addressMask

      private final long addressMask
    • libPattern

      protected final Pattern libPattern
    • javaVersionMajor

      private int javaVersionMajor
  • Constructor Details

  • Method Details

    • determineOS

      private static final Platform.OS_TYPE determineOS()
    • determinePlatform

      private static final Platform determinePlatform(Platform.OS_TYPE os)
    • determineCPU

      private static final Platform.CPU_TYPE determineCPU()
    • determineLibC

      private static final String determineLibC()
    • determineLibExt

      private static final String determineLibExt()
    • determineArchDataModel

      private static int determineArchDataModel()
    • getPlatform

      public static final Platform getPlatform()
      Gets the current Platform
      Returns:
      The current platform.
    • getOS

      public final Platform.OS_TYPE getOS()
      Gets the current Operating System.
      Returns:
      A OS value representing the current Operating System.
    • getCPU

      public final Platform.CPU_TYPE 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. 8 for java 1.8, 9 for java 9
    • 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 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 - 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 String getName()
      Gets the name of this Platform.
      Returns:
      The name of this platform.
    • mapLibraryName

      public String mapLibraryName(String libName)
    • startsWithIgnoreCase

      private static boolean startsWithIgnoreCase(String s1, String s2)