utils
Class OsUtils

java.lang.Object
  extended by utils.OsUtils

public class OsUtils
extends java.lang.Object

Copyright DocJava, inc. User: lyon

Date: Dec 17, 2004

Time: 9:20:42 AM


Constructor Summary
OsUtils()
           
 
Method Summary
static java.lang.String[] executeCommand(java.lang.String com)
          Execute a command on the local OS
static double get15MinuteLoad()
          this is an experimental method that is supposed to compute the load on the CPU for the last 15 minutes.
static java.lang.String getArchName()
           
static java.lang.String getOsName()
          A what to get the properties os.name
static boolean isFreeBsd()
           
static boolean isi386()
           
static boolean isIntelMac()
           
static boolean isLinux()
           
static boolean isMacOs()
           
static boolean isNetBsd()
           
static boolean isOsKnown()
          Runs through the list of known operating systems
static boolean isOsPrefix(java.lang.String prefix)
           
static boolean isPPC()
           
static boolean isPPCMac()
           
static boolean isSolaris()
           
static boolean isWindows()
           
static boolean isWindows(java.lang.String str)
           
static boolean isWindows2000()
           
static boolean isWindows95()
           
static boolean isWindows98()
           
static boolean isWindowsNt()
           
static boolean isWindowsXp()
           
static boolean isx386()
           
static void main(java.lang.String[] args)
           
static void print(java.lang.String[] strings)
          A method for printing an array of strings.
static void runExec(java.lang.String[] args, java.io.File workingDirectory)
          Run the args array using the workingDirectory as the home.
static void testListProperties()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsUtils

public OsUtils()
Method Detail

isOsKnown

public static boolean isOsKnown()
Runs through the list of known operating systems

Returns:
true if the operating system is known.

get15MinuteLoad

public static double get15MinuteLoad()
this is an experimental method that is supposed to compute the load on the CPU for the last 15 minutes. Making this cross-platform is not easy and I don't know what to do about windows.

Returns:
the load (what are the units?)

print

public static void print(java.lang.String[] strings)
A method for printing an array of strings.

Parameters:
strings -

getOsName

public static java.lang.String getOsName()
A what to get the properties os.name

Returns:
the os.name

getArchName

public static java.lang.String getArchName()

isi386

public static boolean isi386()
Returns:
true if on an intel-based mac or linux box

isx386

public static boolean isx386()
Returns:
true if we are on a celeron

isIntelMac

public static boolean isIntelMac()

isPPC

public static boolean isPPC()

isPPCMac

public static boolean isPPCMac()

isMacOs

public static boolean isMacOs()
Returns:
true if it is a mac.

isLinux

public static boolean isLinux()
Returns:
true if it is linux

isNetBsd

public static boolean isNetBsd()
Returns:
true if it is net bsd

isFreeBsd

public static boolean isFreeBsd()
Returns:
true if it is freebsd

isSolaris

public static boolean isSolaris()
Returns:
true if it is solais or sunos

isWindowsNt

public static boolean isWindowsNt()

isWindows2000

public static boolean isWindows2000()

isWindows98

public static boolean isWindows98()

isWindows95

public static boolean isWindows95()

isWindowsXp

public static boolean isWindowsXp()

isWindows

public static boolean isWindows(java.lang.String str)

isWindows

public static boolean isWindows()

executeCommand

public static java.lang.String[] executeCommand(java.lang.String com)
                                         throws java.io.IOException
Execute a command on the local OS

Parameters:
com -
Returns:
an array of string for output from the command.
Throws:
java.io.IOException

isOsPrefix

public static boolean isOsPrefix(java.lang.String prefix)

testListProperties

public static void testListProperties()

main

public static void main(java.lang.String[] args)

runExec

public static void runExec(java.lang.String[] args,
                           java.io.File workingDirectory)
                    throws java.io.IOException
Run the args array using the workingDirectory as the home.

Parameters:
args -
workingDirectory -
Throws:
java.io.IOException