Package com.helger.base.system
Class SystemHelper
java.lang.Object
com.helger.base.system.SystemHelper
Get information about the system we're running on.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic longReturns the amount of free memory in the Java Virtual Machine.static @NonNull EJavaVersionstatic @NonNull EJVMVendorstatic longReturns the maximum amount of memory that the Java virtual machine will attempt to use.static intstatic @NonNull EOperatingSystemstatic @NonNull Stringstatic @NonNull EProcessorArchitecturestatic @NonNull Charsetstatic @NonNull Stringstatic @NonNull Localestatic longReturns the total amount of memory in the Java virtual machine.
-
Method Details
-
getNumberOfProcessors
@Nonnegative public static int getNumberOfProcessors()- Returns:
- The number of processors the computer has.
-
getProcessorArchitecture
- Returns:
- The current processor architecture and never
null.
-
getOperatingSystem
- Returns:
- The operating system we're running on.
-
getOperatingSystemName
- Returns:
- The name and version of the operating system we're running on.
-
getJavaVersion
- Returns:
- The current Java version that is running. Never
null.
-
getJVMVendor
- Returns:
- The vendor of the Java Virtual Machine (JVM) that we're operating on.
-
getSystemLocale
- Returns:
- The system locale.
-
getSystemCharset
- Returns:
- The system charset.
-
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.
-