Class LinuxHardwareAbstractionLayerNF
java.lang.Object
oshi.hardware.common.AbstractHardwareAbstractionLayer
oshi.hardware.common.platform.linux.LinuxHardwareAbstractionLayer
oshi.hardware.common.platform.linux.nativefree.LinuxHardwareAbstractionLayerNF
- All Implemented Interfaces:
HardwareAbstractionLayer
@ThreadSafe
public final class LinuxHardwareAbstractionLayerNF
extends LinuxHardwareAbstractionLayer
Native-free hardware abstraction layer for Linux. Extends
LinuxHardwareAbstractionLayer, providing
implementations that require no native access.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionInstantiates the platform-specificGlobalMemoryobjectInstantiates the platform-specificCentralProcessorobjectInstantiates a list ofHWDiskStoreobjects, representing physical hard disks or other similar storage devices.Instantiates a list ofGraphicsCardobjects, representing the Graphics cards.getNetworkIFs(boolean includeLocalInterfaces) Gets a listNetworkIFobjects, representing a network interface.Instantiates a list ofPowerSourceobjects, representing batteries, etc.getUsbDevices(boolean tree) Instantiates a list ofUsbDeviceobjects, representing devices connected via a usb port (including internal devices).Methods inherited from class LinuxHardwareAbstractionLayer
createComputerSystem, createSensors, getBluetoothDevices, getDisplays, getSoundCardsModifier and TypeMethodDescriptionInstantiates the platform-specificComputerSystemobjectInstantiates the platform-specificSensorsobjectInstantiates a list ofBluetoothDeviceobjects, representing Bluetooth devices (paired or connected) known to the system.Instantiates a list ofDisplayobjects, representing monitors or other video output devices.Instantiates a list ofSoundCardobjects, representing the Sound cards.Methods inherited from class AbstractHardwareAbstractionLayer
getComputerSystem, getMemory, getNetworkIFs, getProcessor, getSensorsModifier and TypeMethodDescriptionInstantiates aComputerSystemobject.Instantiates aGlobalMemoryobject.Gets a list of non-localNetworkIFobjects, representing a network interface.Instantiates aCentralProcessorobject.Instantiates aSensorsobject, representing CPU temperature and fan speed.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HardwareAbstractionLayer
getLogicalVolumeGroups, getPrintersModifier and TypeMethodDescriptiondefault List<LogicalVolumeGroup> Instantiates a list ofLogicalVolumeGroupobjects, representing a storage pool or group of devices, partitions, volumes, or other implementation specific means of file storage.Instantiates a list ofPrinterobjects, representing printers.
-
Constructor Details
-
LinuxHardwareAbstractionLayerNF
public LinuxHardwareAbstractionLayerNF()
-
-
Method Details
-
createMemory
Description copied from class:AbstractHardwareAbstractionLayerInstantiates the platform-specificGlobalMemoryobject- Specified by:
createMemoryin classLinuxHardwareAbstractionLayer- Returns:
- platform-specific
GlobalMemoryobject
-
createProcessor
Description copied from class:AbstractHardwareAbstractionLayerInstantiates the platform-specificCentralProcessorobject- Specified by:
createProcessorin classLinuxHardwareAbstractionLayer- Returns:
- platform-specific
CentralProcessorobject
-
getDiskStores
Description copied from interface:HardwareAbstractionLayerInstantiates a list ofHWDiskStoreobjects, representing physical hard disks or other similar storage devices. Each disk store containspartitionswhose mount points can be correlated withOSFileStore.getMount()to link hardware to file systems.- Returns:
- A list of HWDiskStore objects or an empty list if none are present.
-
getNetworkIFs
Description copied from interface:HardwareAbstractionLayerGets a listNetworkIFobjects, representing a network interface.- Parameters:
includeLocalInterfaces- whether to include local interfaces (loopback or no hardware address) in the result- Returns:
- A list of
NetworkIFobjects representing the interfaces
-
getPowerSources
Description copied from interface:HardwareAbstractionLayerInstantiates a list ofPowerSourceobjects, representing batteries, etc.- Returns:
- A list of PowerSource objects or an empty list if none are present.
-
getUsbDevices
Description copied from interface:HardwareAbstractionLayerInstantiates a list ofUsbDeviceobjects, representing devices connected via a usb port (including internal devices).If the value of
treeis true, the top level devices returned from this method are the USB Controllers; connected hubs and devices in its device tree share that controller's bandwidth. If the value oftreeis false, USB devices (not controllers) are listed in a single flat list.Note: in both cases each
UsbDevicein the returned list may still report connected child devices viaUsbDevice.getConnectedDevices(). Whentreeis false the list is intended for simple iteration over individual devices; callers should not recurse intoUsbDevice.getConnectedDevices()or rely onObject.toString()(which renders the full subtree) to avoid processing devices more than once.To print the full device tree rooted at each controller:
To iterate individual devices without tree structure:for (UsbDevice controller : hal.getUsbDevices(true)) { System.out.println(controller); // toString() renders the full subtree }for (UsbDevice device : hal.getUsbDevices(false)) { // Use individual fields; avoid toString() as it includes the subtree System.out.println(device.getName() + " [" + device.getVendorId() + ":" + device.getProductId() + "]"); }- Parameters:
tree- Iftrue, returns the USB Controllers as top-level entries, with connected hubs and devices accessible viaUsbDevice.getConnectedDevices(). Iffalse, returns a flat list of non-controller devices;UsbDevice.getConnectedDevices()may still be non-empty but should not be iterated to avoid duplicates.- Returns:
- A list of UsbDevice objects representing (optionally) the USB Controllers and devices connected to them, or an empty list if none are present
-
getGraphicsCards
Description copied from interface:HardwareAbstractionLayerInstantiates a list ofGraphicsCardobjects, representing the Graphics cards.- Returns:
- A list of objects or an empty list if none are present.
-