org.bridj
Class Platform

java.lang.Object
  extended by org.bridj.Platform

public class Platform
extends Object

Information about the execution platform (OS, architecture, native sizes...) and platform-specific actions.

Author:
ochafik

Nested Class Summary
static class Platform.DeleteFiles
           
 
Field Summary
static int CLONG_SIZE
           
static int POINTER_SIZE
           
static int SIZE_T_SIZE
           
static int TIME_T_SIZE
           
static boolean useUnicodeVersionOfWindowsAPIs
          Whether to use Unicode versions of Windows APIs rather than ANSI versions (for functions that haven't been bound yet : has no effect on functions that have already been bound).
static int WCHAR_T_SIZE
           
 
Constructor Summary
Platform()
           
 
Method Summary
static void addEmbeddedLibraryResourceRoot(String root)
          BridJ is able to automatically extract native binaries bundled in the application's JARs, using a customizable root path and a predefined architecture-dependent subpath.
static ClassLoader getClassLoader()
           
static ClassLoader getClassLoader(Class<?> cl)
           
static String getMachine()
          Machine (as returned by `uname -m`, except for i686 which is actually i386), adjusted to the JVM platform (32 or 64 bits)
static void initLibrary()
           
static boolean is64Bits()
           
static boolean isAmd64Arch()
           
static boolean isAndroid()
           
static boolean isArm()
           
static boolean isBSD()
           
static boolean isLinux()
           
static boolean isMacOSX()
           
static boolean isSolaris()
           
static boolean isSparc()
           
static boolean isUnix()
           
static boolean isWindows()
           
static boolean isWindows7()
           
static void open(File file)
          Opens a file with the default system action.
static void open(URL url)
          Opens an URL with the default system action.
static void show(File file)
          Show a file in its parent directory, if possible selecting the file (not possible on all platforms).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POINTER_SIZE

public static final int POINTER_SIZE

WCHAR_T_SIZE

public static final int WCHAR_T_SIZE

SIZE_T_SIZE

public static final int SIZE_T_SIZE

TIME_T_SIZE

public static final int TIME_T_SIZE

CLONG_SIZE

public static final int CLONG_SIZE

useUnicodeVersionOfWindowsAPIs

public static boolean useUnicodeVersionOfWindowsAPIs
Whether to use Unicode versions of Windows APIs rather than ANSI versions (for functions that haven't been bound yet : has no effect on functions that have already been bound).
Some Windows APIs such as SendMessage have two versions :
In a C/C++ program, this behaviour is controlled by the UNICODE macro definition.
By default, BridJ will use the Unicode versions. Set this field to false, set the bridj.useUnicodeVersionOfWindowsAPIs property to "false" or the BRIDJ_USE_UNICODE_VERSION_OF_WINDOWS_APIS environment variable to "0" to use the ANSI string version instead.

Constructor Detail

Platform

public Platform()
Method Detail

getClassLoader

public static ClassLoader getClassLoader()

getClassLoader

public static ClassLoader getClassLoader(Class<?> cl)

addEmbeddedLibraryResourceRoot

public static void addEmbeddedLibraryResourceRoot(String root)
BridJ is able to automatically extract native binaries bundled in the application's JARs, using a customizable root path and a predefined architecture-dependent subpath. This method adds an alternative root path to the search list.
For instance, if you want to load library "mylib" and call addEmbeddedLibraryResourceRoot("my/company/lib/"), BridJ will look for library in the following locations : For other platforms or for an updated list of supported platforms, please have a look at BridJ's JAR contents (under "org/bridj/lib") and/or to its source tree, browsable online.


initLibrary

public static void initLibrary()

isLinux

public static boolean isLinux()

isMacOSX

public static boolean isMacOSX()

isSolaris

public static boolean isSolaris()

isBSD

public static boolean isBSD()

isUnix

public static boolean isUnix()

isWindows

public static boolean isWindows()

isWindows7

public static boolean isWindows7()

getMachine

public static String getMachine()
Machine (as returned by `uname -m`, except for i686 which is actually i386), adjusted to the JVM platform (32 or 64 bits)


isAndroid

public static boolean isAndroid()

isArm

public static boolean isArm()

isSparc

public static boolean isSparc()

is64Bits

public static boolean is64Bits()

isAmd64Arch

public static boolean isAmd64Arch()

open

public static final void open(URL url)
                       throws NoSuchMethodException
Opens an URL with the default system action.

Parameters:
url - url to open
Throws:
NoSuchMethodException - if opening an URL on the current platform is not supported

open

public static final void open(File file)
                       throws NoSuchMethodException
Opens a file with the default system action.

Parameters:
file - file to open
Throws:
NoSuchMethodException - if opening a file on the current platform is not supported

show

public static final void show(File file)
                       throws NoSuchMethodException,
                              IOException
Show a file in its parent directory, if possible selecting the file (not possible on all platforms).

Parameters:
file - file to show in the system's default file navigator
Throws:
NoSuchMethodException - if showing a file on the current platform is not supported
IOException


Copyright © 2009-2012. All Rights Reserved.