public final class Compatibility extends Object
It is part of our effort to provide support for both J2SE and J2ME platforms.
IMPORTANT: some of the methods have been modified from their J2SE parents. Refer to the description of each method for specific changes.
Constructor and Description |
---|
Compatibility() |
Modifier and Type | Method and Description |
---|---|
static int |
ceil(int p,
int q)
Answers the most negative (i.e.
|
static void |
exec(String[] prog,
String[] envp,
String workingDir)
Execute prog[0] in a separate platform process if the
underlying platform supports this.
|
static boolean |
fileExists(String parent,
String child)
Answers whether the indicated file exists or not.
|
static String |
getMessage(String key)
Returns the NLS'ed message for the given argument.
|
static String |
getMessage(String key,
Object[] args) |
static int |
pow2(int n)
Returns 2 raised to the power of the argument.
|
static int |
round(int p,
int q)
Answers the result of rounding to the closest integer the number obtained
by dividing the first argument p by the second argument q.
|
public static int ceil(int p, int q)
p
- numeratorq
- denominator (must be different from zero)public static boolean fileExists(String parent, String child)
parent
- the file's parent directorychild
- the file's namepublic static int round(int p, int q)
IMPORTANT: the j2me version has an additional restriction on the arguments. p must be within the range 0 - 32767 (inclusive). q must be within the range 1 - 32767 (inclusive).
p
- numeratorq
- denominator (must be different from zero)public static int pow2(int n)
n
- an int value between 0 and 30 (inclusive)IllegalArgumentException
- public static void exec(String[] prog, String[] envp, String workingDir) throws IOException
The new process inherits the environment of the caller.
prog
- array containing the program to execute and its argumentsenvp
- array of strings, each element of which has environment
variable settings in the format name=valueworkingDir
- the working directory of the new process, or null if the new
process should inherit the working directory of the callerIOException
- if the program cannot be executedSecurityException
- if the current SecurityManager disallows program executionpublic static String getMessage(String key)
key
- the key to look upSWT.getMessage(String)
Copyright © 2017. All Rights Reserved.