Package fr.gouv.vitam.common
Class SystemPropertyUtil
java.lang.Object
fr.gouv.vitam.common.SystemPropertyUtil
A collection of utility methods to retrieve and parse the values of the Java system properties.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumInspired from http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/ SystemUtils.html -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidRemove the key of the Java system property with the specifiedkey.static booleanReturnstrueif and only if the system property with the specifiedkeyexists.static voiddebug(PrintStream out) Print to System.out the content of the propertiesstatic StringReturns the value of the Java system property with the specifiedkey, while falling back tonullif the property access fails.static booleanReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static intReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static longReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static StringReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static booleanReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static intReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static longReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static StringReturns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.static StringgetNoCheck(String key) Returns the value of the Java system property with the specifiedkey, while falling back tonullif the property access fails.static SystemPropertyUtil.PlatformgetOS()static booleanisMac()static booleanstatic booleanisUnix()static booleanstatic voidrefresh()Re-retrieves all system properties so that any post-launch properties updates are retrieved.static booleanSet the value of the Java system property with the specifiedkeyto the specified default value.static intSet the value of the Java system property with the specifiedkeyto the specified default value.static longSet the value of the Java system property with the specifiedkeyto the specified default value.static StringSet the value of the Java system property with the specifiedkeyto the specified default value.
-
Field Details
-
FILE_ENCODING
Default File encoding field- See Also:
-
-
Method Details
-
refresh
public static void refresh()Re-retrieves all system properties so that any post-launch properties updates are retrieved. -
contains
Returnstrueif and only if the system property with the specifiedkeyexists.- Parameters:
key- as String to verify- Returns:
- True if the key is contained
- Throws:
IllegalArgumentException- key null
-
get
Returns the value of the Java system property with the specifiedkey, while falling back tonullif the property access fails.- Parameters:
key- of system property to get- Returns:
- the property value or
null - Throws:
IllegalArgumentException- key null
-
getNoCheck
Returns the value of the Java system property with the specifiedkey, while falling back tonullif the property access fails.- Parameters:
key- of system property to get- Returns:
- the property value or
null - Throws:
IllegalArgumentException- key null
-
get
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- of system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key null
-
get
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- of system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key null
-
get
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- the system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key null
-
get
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- of system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key null
-
getAndSet
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- of system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key or def null
-
getAndSet
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- of system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key null
-
getAndSet
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- of system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key null
-
getAndSet
Returns the value of the Java system property with the specifiedkey, while falling back to the specified default value if the property access fails.- Parameters:
key- of system propertydef- the default value- Returns:
- the property value.
defif there's no such property or if an access to the specified property is not allowed. - Throws:
IllegalArgumentException- key null
-
set
Set the value of the Java system property with the specifiedkeyto the specified default value.- Parameters:
key- of system propertydef- the default value- Returns:
- the ancient value.
- Throws:
IllegalArgumentException- key or def null
-
set
Set the value of the Java system property with the specifiedkeyto the specified default value.- Parameters:
key- of system propertydef- the default value- Returns:
- the ancient value.
- Throws:
IllegalArgumentException- key null
-
set
Set the value of the Java system property with the specifiedkeyto the specified default value.- Parameters:
key- of system propertydef- the default value- Returns:
- the ancient value.
- Throws:
IllegalArgumentException- key null
-
set
Set the value of the Java system property with the specifiedkeyto the specified default value.- Parameters:
key- of system propertydef- the default value- Returns:
- the ancient value.
- Throws:
IllegalArgumentException- key null
-
clear
Remove the key of the Java system property with the specifiedkey.- Parameters:
key- of system property- Throws:
IllegalArgumentException- key null
-
debug
Print to System.out the content of the properties- Parameters:
out- the output stream to be used- Throws:
IllegalArgumentException- out null
-
getOS
- Returns:
- the Platform
-
isWindows
public static boolean isWindows()- Returns:
- True if Windows
-
isMac
public static boolean isMac()- Returns:
- True if Mac
-
isUnix
public static boolean isUnix()- Returns:
- True if Unix
-
isSolaris
public static boolean isSolaris()- Returns:
- True if Solaris
-