com.plumtree.openfoundation.util
Class XPSystem

java.lang.Object
  extended bycom.plumtree.openfoundation.util.XPSystem

public class XPSystem
extends java.lang.Object

The XPSystem class contains several useful class fields and methods. It cannot be instantiated.

Among the facilities provided by the XPSystem class are standard input, standard output, and error output streams; access to externally defined "properties"; a means of loading files and libraries; and a utility method for quickly copying a portion of an array.


Nested Class Summary
static class XPSystem.Error
          The "standard" error output stream.
static class XPSystem.In
          The "standard" input stream.
static class XPSystem.Out
          The "standard" output stream.
 
Constructor Summary
XPSystem()
           
 
Method Summary
static void Exit(int exitCode)
          Terminates the currently running Java Virtual Machine.
static void GarbageCollect()
          Runs the garbage collector.
static java.lang.String GetCurrentDirectory()
          Gets the system property indicated by the specified key.
static long GetCurrentTimeMilliSec()
          Returns the current time in milliseconds.
static java.lang.String GetDevKitVersion()
          Return the runtime environment version as a string (JDK version, .NET runtime version in Open Foundation .NET).
static java.lang.String GetDirectorySeparator()
          Returns the character that is used as a delimiter between the section of the path (on Windows, this should return "\"; on most UNIX platforms this should return "/").
static java.lang.String GetLocalHostName()
          Returns the name of the local host.
static java.lang.String GetSearchPathSeparator()
          Delimiter between the directory of the search path (on Windows, this should return ";"; on most UNIX platforms this should return ":").
static boolean IsRunningInDotNet()
          This is to check if dotnet is running.
static java.lang.String NewLine()
          This is to return new line charactor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPSystem

public XPSystem()
Method Detail

GetCurrentTimeMilliSec

public static long GetCurrentTimeMilliSec()
Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.

See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).

Returns:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
See Also:
Date

Exit

public static void Exit(int exitCode)
Terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.

This method calls the exit method in class Runtime. This method never returns normally.

The call System.exit(n) is effectively equivalent to the call:

 Runtime.getRuntime().exit(n)
 

Parameters:
exitCode - exit status.
Throws:
java.lang.SecurityException - if a security manager exists and its checkExit method doesn't allow exit with the specified status.

GetCurrentDirectory

public static java.lang.String GetCurrentDirectory()
Gets the system property indicated by the specified key.

First, if there is a security manager, its checkPropertyAccess method is called with the key as its argument.

If there is no current set of system properties, a set of system properties is first created and initialized in the same manner as for the getProperties method.

Returns:
the string value of the system property, or the default value if there is no property with that key.
Throws:
java.lang.SecurityException - if a security manager exists and its checkPropertyAccess method doesn't allow access to the specified system property.
java.lang.NullPointerException - if key is null.
java.lang.IllegalArgumentException - if key is empty.

GarbageCollect

public static void GarbageCollect()
Runs the garbage collector.

Calling the gc method suggests that the Java Virtual Machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the Java Virtual Machine has made a best effort to reclaim space from all discarded objects.


IsRunningInDotNet

public static boolean IsRunningInDotNet()
This is to check if dotnet is running.

Returns:
returns false.

NewLine

public static java.lang.String NewLine()
This is to return new line charactor.

Returns:
returns new line seperator.

GetSearchPathSeparator

public static java.lang.String GetSearchPathSeparator()
Delimiter between the directory of the search path (on Windows, this should return ";"; on most UNIX platforms this should return ":").

Returns:
Returns the character.

GetDirectorySeparator

public static java.lang.String GetDirectorySeparator()
Returns the character that is used as a delimiter between the section of the path (on Windows, this should return "\"; on most UNIX platforms this should return "/").

Returns:
character that delimits the path

GetDevKitVersion

public static java.lang.String GetDevKitVersion()
Return the runtime environment version as a string (JDK version, .NET runtime version in Open Foundation .NET). Note that Open Foundation 3.0 requires .NET 1.1+ or JDK 1.4+.

.NET example: 1.1.4322.573
Java example: 1.4.1_02

Returns:
runtime environment version string

GetLocalHostName

public static java.lang.String GetLocalHostName()
Returns the name of the local host. If the host name string is not defined, it returns the IP string of the local host.

Returns:
local host name string


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.