All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.bulletproof.util.Vm

java.lang.Object
   |
   +----com.bulletproof.util.Vm

public class Vm
extends Object
A class that includes a set of special functions


Constructor Index

 o Vm()

Method Index

 o copyArray(Object, int, Object, int, int)
Copies the elements of one array to another array.
 o exec(String, String, int, boolean)
Executes a command.
 o getPlatform()
Returns the platform the Virtual Machine is running under as a string.
 o getTimeStamp()
Returns a time stamp in milliseconds.
 o getUserName()
Returns the username of the user running the Virutal Machine.
 o getVersion()
Returns the version of the Waba Virtual Machine.
 o isColor()
Returns true if the system supports a color display and false otherwise.
 o setDeviceAutoOff(int)
Sets the device's "auto-off" time.
 o sleep(int)
Causes the VM to pause execution for the given number of milliseconds.

Constructors

 o Vm
 public Vm()

Methods

 o copyArray
 public static boolean copyArray(Object srcArray,
                                 int srcStart,
                                 Object dstArray,
                                 int dstStart,
                                 int length)
Copies the elements of one array to another array. This method returns true if the copy is successful. It will return false if the array types are not compatible or if either array is null. If the length parameter would cause the copy to read or write past the end of one of the arrays, an index out of range error will occur. If false is returned then no copying has been performed.

Parameters:
srcArray - the array to copy elements from
srcStart - the starting position in the source array
dstArray - the array to copy elements to
dstStart - the starting position in the destination array
length - the number of elements to copy
 o isColor
 public static boolean isColor()
Returns true if the system supports a color display and false otherwise.

 o getTimeStamp
 public static int getTimeStamp()
Returns a time stamp in milliseconds. The time stamp is the time in milliseconds since some arbitrary starting time fixed when the VM starts executing. The maximum time stamp value is (1 << 30) and when it is reached, the timer will reset to 0 and will continue counting from there.

 o getPlatform
 public static String getPlatform()
Returns the platform the Virtual Machine is running under as a string.

 o getUserName
 public static String getUserName()
Returns the username of the user running the Virutal Machine. Because of Java's security model, this method will return null when called in a Java applet. This method will also return null under most WinCE devices (that will be fixed in a future release).

 o getVersion
 public static int getVersion()
Returns the version of the Waba Virtual Machine. The major version is base 100. For example, version 1.0 has value 100. Version 2.0 has a version value of 200. A beta 0.8 VM will have version 80.

 o exec
 public static int exec(String command,
                        String args,
                        int launchCode,
                        boolean wait)
Executes a command.

As an example, the following call could be used to run the command "scandir /p mydir" under Java, Win32 or WinCE:

 int result = Vm.exec("scandir", "/p mydir", 0, true);
 
This example executes the Scribble program under PalmOS:
 Vm.exec("Scribble", null, 0, false);
 
This example executes the web clipper program under PalmOS, telling it to display a web page by using launchCode 54 (CmdGoToURL).
 Vm.exec("Clipper", "http://www.yahoo.com", 54, true);
 
The args parameter passed to this method is the arguments string to pass to the program being executed.

The launchCode parameter is only used under PalmOS. Under PalmOS, it is the launch code value to use when the Vm calls SysUIAppSwitch(). If 0 is passed, the default launch code (CmdNormalLaunch) is used to execute the program.

The wait parameter passed to this method determines whether to execute the command asynchronously. If false, then the method will return without waiting for the command to complete execution. If true, the method will wait for the program to finish executing and the return value of the method will be the value returned from the application under Java, Win32 and WinCE.

Under PalmOS, the wait parameter is ignored since executing another program terminates the running program.

Parameters:
command - the command to execute
args - command arguments
launchCode - launch code for PalmOS applications
wait - whether to wait for the command to complete execution before returning
 o setDeviceAutoOff
 public static int setDeviceAutoOff(int seconds)
Sets the device's "auto-off" time. This is the time in seconds where, if no user interaction occurs with the device, it turns off. To keep the device always on, pass 0. This method only works under PalmOS. The integer returned is the previous auto-off time in seconds.

 o sleep
 public static void sleep(int millis)
Causes the VM to pause execution for the given number of milliseconds.

Parameters:
millis - time to sleep in milliseconds

All Packages  Class Hierarchy  This Package  Previous  Next  Index