com.foxsmart.ic.util
Class SystemUtils

java.lang.Object
  extended by org.apache.commons.lang.SystemUtils
      extended by com.foxsmart.ic.util.SystemUtils

public class SystemUtils
extends org.apache.commons.lang.SystemUtils

This class provides various system utilities via static methods.


Field Summary
protected static org.apache.commons.logging.Log log
           
static java.lang.String OS_LINUX
          Linux operating system.
static java.lang.String OS_MACOSX
          Mac-OS operating system.
static java.lang.String OS_SOLARIS
          Solaris operating system.
static java.lang.String OS_WINDOWS
          Windows operating system.
 
Fields inherited from class org.apache.commons.lang.SystemUtils
AWT_TOOLKIT, FILE_ENCODING, FILE_SEPARATOR, IS_JAVA_1_1, IS_JAVA_1_2, IS_JAVA_1_3, IS_JAVA_1_4, IS_JAVA_1_5, IS_JAVA_1_6, IS_OS_AIX, IS_OS_HP_UX, IS_OS_IRIX, IS_OS_LINUX, IS_OS_MAC, IS_OS_MAC_OSX, IS_OS_OS2, IS_OS_SOLARIS, IS_OS_SUN_OS, IS_OS_UNIX, IS_OS_WINDOWS, IS_OS_WINDOWS_2000, IS_OS_WINDOWS_95, IS_OS_WINDOWS_98, IS_OS_WINDOWS_ME, IS_OS_WINDOWS_NT, IS_OS_WINDOWS_XP, JAVA_AWT_FONTS, JAVA_AWT_GRAPHICSENV, JAVA_AWT_HEADLESS, JAVA_AWT_PRINTERJOB, JAVA_CLASS_PATH, JAVA_CLASS_VERSION, JAVA_COMPILER, JAVA_ENDORSED_DIRS, JAVA_EXT_DIRS, JAVA_HOME, JAVA_IO_TMPDIR, JAVA_LIBRARY_PATH, JAVA_RUNTIME_NAME, JAVA_RUNTIME_VERSION, JAVA_SPECIFICATION_NAME, JAVA_SPECIFICATION_VENDOR, JAVA_SPECIFICATION_VERSION, JAVA_UTIL_PREFS_PREFERENCES_FACTORY, JAVA_VENDOR, JAVA_VENDOR_URL, JAVA_VERSION, JAVA_VERSION_FLOAT, JAVA_VERSION_INT, JAVA_VERSION_TRIMMED, JAVA_VM_INFO, JAVA_VM_NAME, JAVA_VM_SPECIFICATION_NAME, JAVA_VM_SPECIFICATION_VENDOR, JAVA_VM_SPECIFICATION_VERSION, JAVA_VM_VENDOR, JAVA_VM_VERSION, LINE_SEPARATOR, OS_ARCH, OS_NAME, OS_VERSION, PATH_SEPARATOR, USER_COUNTRY, USER_DIR, USER_HOME, USER_LANGUAGE, USER_NAME, USER_TIMEZONE
 
Constructor Summary
SystemUtils()
           
 
Method Summary
static java.lang.String findPathFromClasspath(java.lang.String suffix)
          Finds a path to the specified suffix based on the classpath.
static java.lang.String getOperatingSystem()
          Gets the operating system.
 
Methods inherited from class org.apache.commons.lang.SystemUtils
getJavaHome, getJavaIoTmpDir, getJavaVersion, getUserDir, getUserHome, isJavaAwtHeadless, isJavaVersionAtLeast, isJavaVersionAtLeast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

OS_LINUX

public static final java.lang.String OS_LINUX
Linux operating system.

See Also:
Constant Field Values

OS_WINDOWS

public static final java.lang.String OS_WINDOWS
Windows operating system.

See Also:
Constant Field Values

OS_MACOSX

public static final java.lang.String OS_MACOSX
Mac-OS operating system.

See Also:
Constant Field Values

OS_SOLARIS

public static final java.lang.String OS_SOLARIS
Solaris operating system.

See Also:
Constant Field Values
Constructor Detail

SystemUtils

public SystemUtils()
Method Detail

findPathFromClasspath

public static java.lang.String findPathFromClasspath(java.lang.String suffix)
Finds a path to the specified suffix based on the classpath. This is done by getting the system classpath and breaking it into its pieces (each piece is separated by a semi-colon). For each piece, the suffix is appended onto the end and then each sub-path within it and checked. If a match is found, that path is returned. For example, if a classpath entry is C:/dir1/dir2/file.jar and the suffix is /subdir/file.exe, then the following paths would be checked in the specified order:
 C:/dir1/dir2/file.jar/subdir/file.exe
 C:/dir1/dir2/subdir/file.exe
 C:/dir1/subdir/file.exe
 C:/subdir/file.exe
 

Parameters:
suffix - the suffix to search for. For example, if you want to search for a path to a file, then you would simple pass in the filename (e.g. "file"). Optionally, you can pass in a sub-path as well (e.g. "/path/file").
Returns:
the path to the suffix or null if one couldn't be found.

getOperatingSystem

public static java.lang.String getOperatingSystem()
Gets the operating system.

Returns:
the operating system.


Copyright © 2005-2008 Fox Smart, Inc. All Rights Reserved.