|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.internal.Compatibility
public final class Compatibility
This class is a placeholder for utility methods commonly used on J2SE platforms but not supported on some J2ME profiles.
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.
Field Summary | |
---|---|
static double |
PI
Returns the PI constant as a double. |
Constructor Summary | |
---|---|
Compatibility()
|
Method Summary | |
---|---|
static int |
ceil(int p,
int q)
Answers the most negative (i.e. |
static int |
cos(int angle,
int length)
Answers the length of the side adjacent to the given angle of a right triangle. |
static boolean |
equalsIgnoreCase(java.lang.String s1,
java.lang.String s2)
Compares two instances of class String ignoring the case of the characters and answers if they are equal. |
static void |
exec(java.lang.String prog)
Execute a program in a separate platform process if the underlying platform support this. |
static void |
exec(java.lang.String[] progArray)
Execute progArray[0] in a separate platform process if the underlying platform support this. |
static boolean |
fileExists(java.lang.String parent,
java.lang.String child)
Answers whether the indicated file exists or not. |
static int |
floor(int p,
int q)
Answers the most positive (i.e. |
static java.lang.String |
getMessage(java.lang.String key)
Returns the NLS'ed message for the given argument. |
static java.lang.String |
getMessage(java.lang.String key,
java.lang.Object[] args)
|
static void |
interrupt()
Interrupt the current thread. |
static boolean |
isLetter(char c)
Answers whether the character is a letter. |
static boolean |
isLetterOrDigit(char c)
Answers whether the character is a letter or a digit. |
static boolean |
isSpaceChar(char c)
Answers whether the character is a Unicode space character. |
static boolean |
isWhitespace(char c)
Answers whether the character is a whitespace character. |
static java.io.OutputStream |
newDeflaterOutputStream(java.io.OutputStream stream)
Create an DeflaterOutputStream if such things are supported. |
static java.io.InputStream |
newFileInputStream(java.lang.String filename)
Open a file if such things are supported. |
static java.io.OutputStream |
newFileOutputStream(java.lang.String filename)
Open a file if such things are supported. |
static java.io.InputStream |
newInflaterInputStream(java.io.InputStream stream)
Create an InflaterInputStream if such things are supported. |
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. |
static int |
sin(int angle,
int length)
Answers the length of the side opposite to the given angle of a right triangle. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static double PI
Constructor Detail |
---|
public Compatibility()
Method Detail |
---|
public static int cos(int angle, int length)
IMPORTANT: the j2me version has an additional restriction on the argument. length must be between -32767 and 32767 (inclusive).
angle
- the angle in degreeslength
- the length of the triangle's hypotenuse
public static int sin(int angle, int length)
IMPORTANT: the j2me version has an additional restriction on the argument. length must be between -32767 and 32767 (inclusive).
angle
- the angle in degreeslength
- the length of the triangle's hypotenuse
public static int ceil(int p, int q)
p
- numeratorq
- denominator (must be different from zero)
public static boolean fileExists(java.lang.String parent, java.lang.String child)
parent
- the file's parent directorychild
- the file's name
public static int floor(int p, int q)
p
- numeratorq
- denominator (must be different from zero)
public 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)
java.lang.IllegalArgumentException
- public static java.io.OutputStream newDeflaterOutputStream(java.io.OutputStream stream) throws java.io.IOException
stream
- the output stream
null
java.io.IOException
public static java.io.InputStream newFileInputStream(java.lang.String filename) throws java.io.IOException
filename
- the name of the file to open
java.io.IOException
public static java.io.OutputStream newFileOutputStream(java.lang.String filename) throws java.io.IOException
filename
- the name of the file to open
java.io.IOException
public static java.io.InputStream newInflaterInputStream(java.io.InputStream stream) throws java.io.IOException
stream
- the input stream
null
java.io.IOException
public static boolean isLetter(char c)
c
- the character
public static boolean isLetterOrDigit(char c)
c
- the character
public static boolean isSpaceChar(char c)
c
- the character
public static boolean isWhitespace(char c)
c
- the character to test
public static void exec(java.lang.String prog) throws java.io.IOException
The new process inherits the environment of the caller.
prog
- the name of the program to execute
java.io.IOException
- if the program cannot be executed
java.lang.SecurityException
- if the current SecurityManager disallows program executionpublic static void exec(java.lang.String[] progArray) throws java.io.IOException
The new process inherits the environment of the caller.
progArray
- array containing the program to execute and its arguments
java.io.IOException
- if the program cannot be executed
java.lang.SecurityException
- if the current SecurityManager disallows program executionpublic static java.lang.String getMessage(java.lang.String key)
key
- the key to look up
SWT.getMessage(String)
public static java.lang.String getMessage(java.lang.String key, java.lang.Object[] args)
public static void interrupt()
Note that this is not available on CLDC.
public static boolean equalsIgnoreCase(java.lang.String s1, java.lang.String s2)
s1
- strings2
- string
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |