edu.neu.ccs.util
Class SystemUtilities

java.lang.Object
  extended byedu.neu.ccs.util.SystemUtilities

public class SystemUtilities
extends Object

Provides utility methods for gathering information about the system and activating system components.

This class contains an impure method, by the 100% Pure Java standard. This impurity is acceptable, as it is covered by variances 1, 5 as described in the 100% Pure Java Cookbook. Please see the documentation for the execute method for more details.

Since:
1.0
Version:
2.2

Constructor Summary
SystemUtilities()
           
 
Method Summary
static void beep()
          Sounds the machine beep.
static void execute(String command)
          Spawns a new system process using the given command line.
static long getFreeMemory()
          Returns the number of free bytes of system memory.
static String getLineSeparator()
          Returns the platform specific line separator.
static long getTotalMemory()
          Returns the total number of bytes of system memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemUtilities

public SystemUtilities()
Method Detail

beep

public static void beep()
Sounds the machine beep.


execute

public static void execute(String command)
                    throws IOException
Spawns a new system process using the given command line. Please note that this process will not be a lightweight Java thread, but rather a full operating system process. This method is usually a violation of the 100% Pure Java standard, but is protected in the JPT by variances 1, 5, as this functionality is included in the JPT as a convenience to be used for building an operating system shell or opening a browser window.

Parameters:
command - the full command line to execute
Throws:
IOException - if there was an error spawning the process

getFreeMemory

public static long getFreeMemory()
Returns the number of free bytes of system memory.

See Also:
getTotalMemory()

getLineSeparator

public static String getLineSeparator()
Returns the platform specific line separator. If the line separator sequence for this system is unavailable due to security restrictions, the newline character, '\n' is returned by default.


getTotalMemory

public static long getTotalMemory()
Returns the total number of bytes of system memory.

See Also:
getFreeMemory()