Package oshi
Class SystemInfo
- java.lang.Object
-
- oshi.SystemInfo
-
public class SystemInfo extends java.lang.Object
System information. This is the main entry point to OSHI.This object provides getters which instantiate the appropriate platform-specific implementations of
OperatingSystem
(software) andHardwareAbstractionLayer
(hardware).
-
-
Field Summary
Fields Modifier and Type Field Description private static PlatformEnum
CURRENT_PLATFORM
private java.util.function.Supplier<HardwareAbstractionLayer>
hardware
private static java.lang.String
NOT_SUPPORTED
private java.util.function.Supplier<OperatingSystem>
os
-
Constructor Summary
Constructors Constructor Description SystemInfo()
Create a new instance ofSystemInfo
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static HardwareAbstractionLayer
createHardware()
private static OperatingSystem
createOperatingSystem()
static PlatformEnum
getCurrentPlatform()
Gets thePlatformEnum
value representing this system.HardwareAbstractionLayer
getHardware()
Creates a new instance of the appropriate platform-specificHardwareAbstractionLayer
.OperatingSystem
getOperatingSystem()
Creates a new instance of the appropriate platform-specificOperatingSystem
.
-
-
-
Field Detail
-
CURRENT_PLATFORM
private static final PlatformEnum CURRENT_PLATFORM
-
NOT_SUPPORTED
private static final java.lang.String NOT_SUPPORTED
- See Also:
- Constant Field Values
-
os
private final java.util.function.Supplier<OperatingSystem> os
-
hardware
private final java.util.function.Supplier<HardwareAbstractionLayer> hardware
-
-
Constructor Detail
-
SystemInfo
public SystemInfo()
Create a new instance ofSystemInfo
. This is the main entry point to OSHI and provides access to cross-platform code.Platform-specific Hardware and Software objects are retrieved via memoized suppliers. To conserve memory at the cost of additional processing time, create a new version of SystemInfo() for subsequent calls. To conserve processing time at the cost of additional memory usage, re-use the same
SystemInfo
object for future queries.
-
-
Method Detail
-
getCurrentPlatform
public static PlatformEnum getCurrentPlatform()
Gets thePlatformEnum
value representing this system.- Returns:
- Returns the current platform
-
getOperatingSystem
public OperatingSystem getOperatingSystem()
Creates a new instance of the appropriate platform-specificOperatingSystem
.- Returns:
- A new instance of
OperatingSystem
.
-
createOperatingSystem
private static OperatingSystem createOperatingSystem()
-
getHardware
public HardwareAbstractionLayer getHardware()
Creates a new instance of the appropriate platform-specificHardwareAbstractionLayer
.- Returns:
- A new instance of
HardwareAbstractionLayer
.
-
createHardware
private static HardwareAbstractionLayer createHardware()
-
-