|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opengts.util.OSTools
public class OSTools
| Field Summary | |
|---|---|
static int |
OS_BSD
|
static int |
OS_BSD_FREEBSD
|
static int |
OS_LINUX
|
static int |
OS_LINUX_CENTOS
|
static int |
OS_LINUX_DEBIAN
|
static int |
OS_LINUX_FEDORA
|
static int |
OS_LINUX_UBUNTU
|
static int |
OS_MACOS
|
static int |
OS_MACOS_X
|
static int |
OS_SUBTYPE_MASK
|
static int |
OS_TYPE_MASK
|
static int |
OS_UNIX
|
static int |
OS_UNIX_AIX
|
static int |
OS_UNIX_DIGITAL
|
static int |
OS_UNIX_HPUX
|
static int |
OS_UNIX_IRIX
|
static int |
OS_UNIX_SOLARIS
|
static int |
OS_UNIX_SUNOS
|
static int |
OS_UNKNOWN
|
static int |
OS_WINDOWS
|
static int |
OS_WINDOWS_2000
|
static int |
OS_WINDOWS_2003
|
static int |
OS_WINDOWS_7
|
static int |
OS_WINDOWS_9X
|
static int |
OS_WINDOWS_CE
|
static int |
OS_WINDOWS_CYGWIN
|
static int |
OS_WINDOWS_NT
|
static int |
OS_WINDOWS_VISTA
|
static int |
OS_WINDOWS_XP
|
static java.lang.String |
PROPERTY_JAVA_HOME
|
static java.lang.String |
PROPERTY_JAVA_SPECIFICATION_VERSION
|
static java.lang.String |
PROPERTY_JAVA_VENDOR
|
| Constructor Summary | |
|---|---|
OSTools()
|
|
| Method Summary | |
|---|---|
static void |
checkMemoryUsage(boolean reset)
Analyzes/Prints the current memory usage. (This method only analyzes/prints memory usage if the current usage is less than the previous usage, implying that a garbage collection has recently occured) Useful for determining IF there are memory leaks, and how much it is leaking, but useless for determining WHERE the leak is occurring. |
static java.lang.String[] |
createJavaCommand(java.lang.String[] classpath,
java.lang.String className,
java.lang.String[] args)
Returns a Java command set up to be executed by Runtime.getRuntime().exec(...) |
static java.lang.Class |
getCallerClass(int frame)
Gets the class of the caller at the specified frame index |
static java.lang.String |
getHostIP()
Gets the current host IP address |
static java.lang.String |
getHostName()
Gets the current host name |
static long[] |
getMemoryUsage(long[] L)
Get the current memory usage (in number of bytes) |
static java.lang.String |
getMemoryUsageStringMb()
Get the current memory usage String |
static int |
getOSType()
Returns the known OS type as an integer bitmask |
static java.lang.String |
getOSTypeName(int type,
boolean inclSubtype)
Returns the String representation of the specified OS type |
static int |
getProcessID()
Gets the Process-ID of this JVM invocation. IMPORTANT: This implementation relies on a "convention", rather that a documented method of obtaining the process-id of this JVM within the OS. |
static boolean |
hasGetCallerClass()
Returns true if 'sun.reflect.Reflection' is present in the runtime libraries. (will return true when running with the Sun Microsystems version of Java) |
static boolean |
instanceOf(java.lang.Object obj,
java.lang.String className)
Returns true if the specified object is an instance of (or equal to) the specified class name. |
static boolean |
isBrokenToFront()
Returns true if this implementation has a broken 'toFront' Swing implementation. (may only be applicable on Java v1.4.2) |
static boolean |
isLinux()
Returns true if the OS is Unix/Linux |
static boolean |
isMacOS()
Returns true if the OS is Apple Mac OS |
static boolean |
isMacOSX()
Returns true if the OS is Apple Mac OS X |
static boolean |
isOSType(int type)
Returns true if the OS is the specified type |
static boolean |
isOSType(int type,
int subType)
Returns true if the OS is the specified type |
static boolean |
isSunJava()
Returns true if executed from a Sun Microsystems JVM. |
static boolean |
isUnknown()
Returns true if the OS is unknown |
static boolean |
isWindows()
Returns true if the OS is a flavor of Windows |
static boolean |
isWindows9X()
Returns true if the OS is Windows 95/98 |
static boolean |
isWindowsXP()
Returns true if the OS is Windows XP |
static void |
main(java.lang.String[] argv)
Main entry point for testing/debugging |
static void |
printCallerClasses()
Prints the class of the caller (debug purposes only) |
static void |
printMemoryUsage()
Prints the current memory usage to the log file |
static void |
printMemoryUsageMXBean()
Prints the current memory usage to the log file |
static boolean |
sleepMS(long ms)
Sleeps for the specified number of milliseconds |
static boolean |
sleepSec(long sec)
Sleeps for the specified number of seconds |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int OS_TYPE_MASK
public static final int OS_SUBTYPE_MASK
public static final int OS_UNKNOWN
public static final int OS_LINUX
public static final int OS_LINUX_FEDORA
public static final int OS_LINUX_CENTOS
public static final int OS_LINUX_UBUNTU
public static final int OS_LINUX_DEBIAN
public static final int OS_UNIX
public static final int OS_UNIX_SOLARIS
public static final int OS_UNIX_SUNOS
public static final int OS_UNIX_AIX
public static final int OS_UNIX_DIGITAL
public static final int OS_UNIX_HPUX
public static final int OS_UNIX_IRIX
public static final int OS_BSD
public static final int OS_BSD_FREEBSD
public static final int OS_MACOS
public static final int OS_MACOS_X
public static final int OS_WINDOWS
public static final int OS_WINDOWS_9X
public static final int OS_WINDOWS_XP
public static final int OS_WINDOWS_VISTA
public static final int OS_WINDOWS_7
public static final int OS_WINDOWS_CE
public static final int OS_WINDOWS_NT
public static final int OS_WINDOWS_2000
public static final int OS_WINDOWS_2003
public static final int OS_WINDOWS_CYGWIN
public static final java.lang.String PROPERTY_JAVA_HOME
public static final java.lang.String PROPERTY_JAVA_VENDOR
public static final java.lang.String PROPERTY_JAVA_SPECIFICATION_VERSION
| Constructor Detail |
|---|
public OSTools()
| Method Detail |
|---|
public static int getOSType()
public static java.lang.String getOSTypeName(int type,
boolean inclSubtype)
type - The OS type
public static boolean isOSType(int type)
public static boolean isOSType(int type,
int subType)
public static boolean isUnknown()
public static boolean isWindows()
public static boolean isWindowsXP()
public static boolean isWindows9X()
public static boolean isLinux()
public static boolean isMacOS()
public static boolean isMacOSX()
public static java.lang.String getHostName()
public static java.lang.String getHostIP()
public static long[] getMemoryUsage(long[] L)
L - The long array where the memory values will be placed. If 'null',
is specified, or if the array has fewer than 3 elements, a new
long array will be returned.
then the array must be
public static java.lang.String getMemoryUsageStringMb()
public static void printMemoryUsage()
public static void printMemoryUsageMXBean()
public static void checkMemoryUsage(boolean reset)
reset - True to reset the memory growth-rate checks.public static boolean isBrokenToFront()
public static boolean isSunJava()
public static java.lang.Class getCallerClass(int frame)
frame - The frame index
public static boolean hasGetCallerClass()
public static void printCallerClasses()
public static int getProcessID()
public static java.lang.String[] createJavaCommand(java.lang.String[] classpath,
java.lang.String className,
java.lang.String[] args)
classpath - The classpathclassName - The main Java class nameargs - The command line arguments
public static boolean instanceOf(java.lang.Object obj,
java.lang.String className)
public static boolean sleepMS(long ms)
ms - Number of milliseconds to sleep
public static boolean sleepSec(long sec)
sec - Number of milliseconds to sleep
public static void main(java.lang.String[] argv)
argv - Comand-line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||