OSHI: Get HWDiskStore for a given path

后端 未结 1 728
傲寒
傲寒 2021-01-21 12:57

I am using OSHI https://github.com/oshi/oshi to monitor the hardware.

There is a method

HWDiskStore[] getDisks();

https://github.com/o

相关标签:
1条回答
  • 2021-01-21 13:40

    The DiskStore is a hardware object (e.g., hard drive, SSD, etc.) which is part of the machinery, while the FileStore is a software object associated with the Operating System / File System.

    OSHI's HWDiskStore objects have a getPartitions() method, which returns an array of HWPartition objects. These objects have a getMountPoint() method which should be a String corresponding to the OSFileStore mount point.

    OSHI's OSFileStore objects correspond to the Java FileStore objects and have a getMount() method which should directly match the HWPartition mount point.

    This demo class gives an example of how this information can be correlated.

    0 讨论(0)
提交回复
热议问题