com.levigo.jadice.document.util
Class SystemEnvironment

java.lang.Object
  extended by com.levigo.jadice.document.util.SystemEnvironment

public final class SystemEnvironment
extends Object

SystemEnvironment is a utility class to provide different informations about the system environment.


Constructor Summary
SystemEnvironment()
           
 
Method Summary
static int getJVMBuildVersionNumber()
          Returns the build version number of the current jvm.
static int getJVMMajorVersionNumber()
          Returns the major version number of current jvm.
static int getJVMMicroVersionNumber()
          Returns the micro version number of the current jvm.
static int getJVMMinorVersionNumber()
          Returns the minor version number of the current jvm.
static String getJVMVersion()
          Returns the jvm version as string.
static String getLineSeparator()
          Returns the line separator which depends on the current os.
static String getSystemPropertySecure(String propKey)
          Allows secure access to system properties without the risk of a thrown SecurityException if the calling thread is not allowed to access the system property with the specified key name.
static String getSystemPropertySecure(String propKey, String defaultValue)
          Allows secure access to system properties without the risk of a thrown SecurityException if the calling thread is not allowed to access the system property with the specified key name.
static String getTempDir()
          Returns the current temp file path as string.
static String getTempDir(String defaultValue)
          Returns the current temp file path as string.
static File getTempDirFile(String defaultValue)
          Returns the current temp file path as file object.
static String getUserHome()
          Returns the user home path as string.
static String getUserHome(String defaultValue)
          Returns the user home path as string.
static File getUserHomeFile(String defaultValue)
          Returns the user home path as file object.
static boolean isJVMBuildVersionNewerOrEqual(int version)
          Returns whether the current jvm build version is newer or equal to the given number.
static boolean isJVMMajorVersionNewerOrEqual(int version)
          Returns whether the current jvm major version is newer or equal to the given number.
static boolean isJVMMicroVersionNewerOrEqual(int version)
          Returns whether the current jvm micro version is newer or equal to the given number.
static boolean isJVMMinorVersionNewerOrEqual(int version)
          Returns whether the current jvm minor version is newer or equal to the given number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemEnvironment

public SystemEnvironment()
Method Detail

getJVMVersion

public static final String getJVMVersion()
Returns the jvm version as string. This property is always accessible and available, so the returning value should not be null.

Returns:
string description of the current jvm version

getJVMMajorVersionNumber

public static final int getJVMMajorVersionNumber()
Returns the major version number of current jvm. For example if the current version is 1.5.0_12-b04, the returned value is 1. This property is always accessible and available, so the returning value should be valid.

Returns:
current jvm major version as int

getJVMMinorVersionNumber

public static final int getJVMMinorVersionNumber()
Returns the minor version number of the current jvm. For example if the current version is 1.5.0_12-b04, the returned value is 5. If the jvm version is 1.6.0_04-b12, the returned value is 6. This property is always accessible and available, so the returning value should be valid.

Returns:
current jvm product version as int

getJVMMicroVersionNumber

public static final int getJVMMicroVersionNumber()
Returns the micro version number of the current jvm. For example if the current version is 1.5.0_12-b04, the returned value is 0. This property is always accessible and available, so the returning value should be valid.

Returns:
current jvm product version as int

getJVMBuildVersionNumber

public static final int getJVMBuildVersionNumber()
Returns the build version number of the current jvm. For example if the current version is 1.5.0_12-b04, the returned value is 12.

Returns:
current jvm product version as int

isJVMMajorVersionNewerOrEqual

public static final boolean isJVMMajorVersionNewerOrEqual(int version)
Returns whether the current jvm major version is newer or equal to the given number.

Parameters:
version -
Returns:
boolean
See Also:
getJVMMajorVersionNumber()

isJVMMinorVersionNewerOrEqual

public static final boolean isJVMMinorVersionNewerOrEqual(int version)
Returns whether the current jvm minor version is newer or equal to the given number.

Parameters:
version -
Returns:
boolean
See Also:
getJVMMinorVersionNumber()

isJVMMicroVersionNewerOrEqual

public static final boolean isJVMMicroVersionNewerOrEqual(int version)
Returns whether the current jvm micro version is newer or equal to the given number.

Parameters:
version -
Returns:
boolean
See Also:
getJVMMicroVersionNumber()

isJVMBuildVersionNewerOrEqual

public static final boolean isJVMBuildVersionNewerOrEqual(int version)
Returns whether the current jvm build version is newer or equal to the given number.

Parameters:
version -
Returns:
boolean
See Also:
getJVMBuildVersionNumber()

getLineSeparator

public static final String getLineSeparator()
Returns the line separator which depends on the current os. It may be a single newline ('\n') or a newline and line feed ("\n\l") character or other other line ending characters. This property is always accessible and available, so the returning value should not be null.

Returns:
string line separator

getTempDir

public static final String getTempDir()
Returns the current temp file path as string. If not available or not accessible, the given null will be returned.

Returns:
string temp file path name or null if this property is not available or accessible

getTempDir

public static final String getTempDir(String defaultValue)
Returns the current temp file path as string. If not available or not accessible, the given defaultValue will be returned.

Returns:
string temp file path name or given default value if this property is not available or accessible

getTempDirFile

public static final File getTempDirFile(String defaultValue)
Returns the current temp file path as file object. If not available or not accessible, a file object pointing to the given defaultValue path will be returned. If the defaultValue is null and the temp file property is not available null will be returned.

Returns:
temp file path as file object

getUserHome

public static final String getUserHome()
Returns the user home path as string. If not available or not accessible, null will be returned.

Returns:
string user home path name or null if this property is not available or accessible

getUserHome

public static final String getUserHome(String defaultValue)
Returns the user home path as string. If not available or not accessible, the given defaultValue will be returned.

Returns:
string user home path name or given default value if this property is not available or accessible

getUserHomeFile

public static final File getUserHomeFile(String defaultValue)
Returns the user home path as file object. If not available or not accessible, a file object pointing to the given defaultValue path will be returned. If the defaultValue is null and user home property is not available null will be returned.

Returns:
user home path as file object

getSystemPropertySecure

public static final String getSystemPropertySecure(String propKey)
Allows secure access to system properties without the risk of a thrown SecurityException if the calling thread is not allowed to access the system property with the specified key name. If the property value is not available or not accessible, null will be returned.

Returns:
string the value of the demanded property or null if this property is not available or accessible

getSystemPropertySecure

public static final String getSystemPropertySecure(String propKey,
                                                   String defaultValue)
Allows secure access to system properties without the risk of a thrown SecurityException if the calling thread is not allowed to access the system property with the specified key name. If the property value is not available or not accessible, the given defaulValue will be returned.

Returns:
string the value of the demanded property or defaulValue if this property is not available or accessible


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.