Package com.helger.commons.system
Class SystemHelper
- java.lang.Object
-
- com.helger.commons.system.SystemHelper
-
@Immutable public final class SystemHelper extends Object
Get information about the system we're running on.- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longgetFreeMemory()Returns the amount of free memory in the Java Virtual Machine.static EJavaVersiongetJavaVersion()static EJVMVendorgetJVMVendor()static longgetMaxMemory()Returns the maximum amount of memory that the Java virtual machine will attempt to use.static intgetNumberOfProcessors()static EOperatingSystemgetOperatingSystem()static StringgetOperatingSystemName()static EProcessorArchitecturegetProcessorArchitecture()static CharsetgetSystemCharset()static StringgetSystemCharsetName()static LocalegetSystemLocale()static longgetTotalMemory()Returns the total amount of memory in the Java virtual machine.
-
-
-
Method Detail
-
getNumberOfProcessors
@Nonnegative public static int getNumberOfProcessors()
- Returns:
- The number of processors the computer has.
-
getProcessorArchitecture
@Nonnull public static EProcessorArchitecture getProcessorArchitecture()
- Returns:
- The current processor architecture and never
null.
-
getOperatingSystem
@Nonnull public static EOperatingSystem getOperatingSystem()
- Returns:
- The operating system we're running on.
-
getOperatingSystemName
@Nonnull public static String getOperatingSystemName()
- Returns:
- The name and version of the operating system we're running on.
-
getJavaVersion
@Nonnull public static EJavaVersion getJavaVersion()
- Returns:
- The current Java version that is running. Never
null.
-
getJVMVendor
@Nonnull public static EJVMVendor getJVMVendor()
- Returns:
- The vendor of the Java Virtual Machine (JVM) that we're operating on.
-
getSystemCharsetName
@Nonnull public static String getSystemCharsetName()
- Returns:
- The name of the system charset.
-
getFreeMemory
@Nonnegative public static long getFreeMemory()
Returns the amount of free memory in the Java Virtual Machine.- Returns:
- an approximation to the total amount of memory currently available for future allocated objects, measured in bytes.
-
getMaxMemory
@Nonnegative public static long getMaxMemory()
Returns the maximum amount of memory that the Java virtual machine will attempt to use. If there is no inherent limit then the valueLong.MAX_VALUEwill be returned.- Returns:
- the maximum amount of memory that the virtual machine will attempt to use, measured in bytes
-
getTotalMemory
@Nonnegative public static long getTotalMemory()
Returns the total amount of memory in the Java virtual machine. The value returned by this method may vary over time, depending on the host environment.Note that the amount of memory required to hold an object of any given type may be implementation-dependent.
- Returns:
- the total amount of memory currently available for current and future objects, measured in bytes.
-
-