Package oshi.hardware

Interface HWDiskStore

All Known Implementing Classes:
AbstractHWDiskStore, AixHWDiskStore, FreeBsdHWDiskStore, LinuxHWDiskStore, MacHWDiskStore, OpenBsdHWDiskStore, SolarisHWDiskStore, WindowsHWDiskStore

@ThreadSafe public interface HWDiskStore
A storage mechanism where data are recorded by various electronic, magnetic, optical, or mechanical changes to a surface layer of one or more rotating disks or or flash storage such as a removable or solid state drive. In constrast to a File System, defining the way an Operating system uses the storage, the Disk Store represents the hardware which a FileSystem uses for its File Stores.

Thread safe for the designed use of retrieving the most recent data. Users should be aware that the updateAttributes() method may update attributes, including the time stamp, and should externally synchronize such usage to ensure consistent calculations.

  • Method Details

    • getName

      String getName()
      The disk name
      Returns:
      the name
    • getModel

      String getModel()
      The disk model
      Returns:
      the model
    • getSerial

      String getSerial()
      The disk serial number, if available.
      Returns:
      the serial number
    • getSize

      long getSize()
      The size of the disk
      Returns:
      the disk size, in bytes
    • getReads

      long getReads()
      The number of reads from the disk
      Returns:
      the reads
    • getReadBytes

      long getReadBytes()
      The number of bytes read from the disk
      Returns:
      the bytes read
    • getWrites

      long getWrites()
      The number of writes to the disk
      Returns:
      the writes
    • getWriteBytes

      long getWriteBytes()
      The number of bytes written to the disk
      Returns:
      the bytes written
    • getCurrentQueueLength

      long getCurrentQueueLength()
      The length of the disk queue (#I/O's in progress). Includes I/O requests that have been issued to the device driver but have not yet completed. Not supported on macOS.
      Returns:
      the current disk queue length
    • getTransferTime

      long getTransferTime()
      The time spent reading or writing, in milliseconds.
      Returns:
      the transfer time
    • getPartitions

      List<HWPartition> getPartitions()
      The partitions on this disk.
      Returns:
      an UnmodifiableList of the partitions on this drive.
    • getTimeStamp

      long getTimeStamp()
      The time this disk's statistics were updated.
      Returns:
      the timeStamp, in milliseconds since the epoch.
    • updateAttributes

      boolean updateAttributes()
      Make a best effort to update all the statistics about the drive without needing to recreate the drive list. This method provides for more frequent periodic updates of individual drive statistics but may be less efficient to use if updating all drives. It will not detect if a removable drive has been removed and replaced by a different drive in between method calls.
      Returns:
      True if the update was (probably) successful, false if the disk was not found