Class SystemInfo
java.lang.Object
oshi.nativefree.SystemInfo
- All Implemented Interfaces:
SystemInfoProvider
Native-free
SystemInfoProvider for Linux. Uses only procfs, sysfs, and standard Java APIs — no JNA, no FFM,
no --enable-native-access required.
This provider is registered at priority 0 (lowest) and is only selected when no higher-priority provider (JNA or FFM) is available on the classpath.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance of the appropriate platform-specificHardwareAbstractionLayer.Creates a new instance of the appropriate platform-specificOperatingSystem.intReturns the priority of this provider.booleanReturns whether this provider is available in the current runtime environment.
-
Constructor Details
-
SystemInfo
public SystemInfo()Creates a new native-free LinuxSystemInfoinstance.
-
-
Method Details
-
getOperatingSystem
Description copied from interface:SystemInfoProviderCreates a new instance of the appropriate platform-specificOperatingSystem.- Specified by:
getOperatingSystemin interfaceSystemInfoProvider- Returns:
- A new instance of
OperatingSystem.
-
getHardware
Description copied from interface:SystemInfoProviderCreates a new instance of the appropriate platform-specificHardwareAbstractionLayer.- Specified by:
getHardwarein interfaceSystemInfoProvider- Returns:
- A new instance of
HardwareAbstractionLayer.
-
getPriority
public int getPriority()Description copied from interface:SystemInfoProviderReturns the priority of this provider. Higher values indicate higher priority. When multiple providers are available, the one with the highest priority is selected.Priority 0 is reserved for a potential future no-native-access fallback. The JNA-based provider (
oshi-core) returns 10. The FFM-based provider (oshi-core-ffm) returns 20 (preferred when available).- Specified by:
getPriorityin interfaceSystemInfoProvider- Returns:
- the priority of this provider
-
isAvailable
public boolean isAvailable()Description copied from interface:SystemInfoProviderReturns whether this provider is available in the current runtime environment.A provider may be unavailable if the current platform is not supported or if required runtime features (such as the FFM API on JDK 25+) are not present.
- Specified by:
isAvailablein interfaceSystemInfoProvider- Returns:
trueif this provider can be used in the current environment
-