Class WindowsHWDiskStore

java.lang.Object
oshi.hardware.common.AbstractHWDiskStore
oshi.hardware.platform.windows.WindowsHWDiskStore
All Implemented Interfaces:
HWDiskStore

@ThreadSafe public final class WindowsHWDiskStore extends AbstractHWDiskStore
Windows hard disk implementation.
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • PHYSICALDRIVE_PREFIX

      private static final String PHYSICALDRIVE_PREFIX
      See Also:
    • DEVICE_ID

      private static final Pattern DEVICE_ID
    • GUID_BUFSIZE

      private static final int GUID_BUFSIZE
      See Also:
    • reads

      private long reads
    • readBytes

      private long readBytes
    • writes

      private long writes
    • writeBytes

      private long writeBytes
    • currentQueueLength

      private long currentQueueLength
    • transferTime

      private long transferTime
    • timeStamp

      private long timeStamp
    • partitionList

      private List<HWPartition> partitionList
  • Constructor Details

    • WindowsHWDiskStore

      private WindowsHWDiskStore(String name, String model, String serial, long size)
  • Method Details

    • getReads

      public long getReads()
      Description copied from interface: HWDiskStore
      The number of reads from the disk
      Returns:
      the reads
    • getReadBytes

      public long getReadBytes()
      Description copied from interface: HWDiskStore
      The number of bytes read from the disk
      Returns:
      the bytes read
    • getWrites

      public long getWrites()
      Description copied from interface: HWDiskStore
      The number of writes to the disk
      Returns:
      the writes
    • getWriteBytes

      public long getWriteBytes()
      Description copied from interface: HWDiskStore
      The number of bytes written to the disk
      Returns:
      the bytes written
    • getCurrentQueueLength

      public long getCurrentQueueLength()
      Description copied from interface: HWDiskStore
      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

      public long getTransferTime()
      Description copied from interface: HWDiskStore
      The time spent reading or writing, in milliseconds.
      Returns:
      the transfer time
    • getTimeStamp

      public long getTimeStamp()
      Description copied from interface: HWDiskStore
      The time this disk's statistics were updated.
      Returns:
      the timeStamp, in milliseconds since the epoch.
    • getPartitions

      public List<HWPartition> getPartitions()
      Description copied from interface: HWDiskStore
      The partitions on this disk.
      Returns:
      an UnmodifiableList of the partitions on this drive.
    • updateAttributes

      public boolean updateAttributes()
      Description copied from interface: HWDiskStore
      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
    • getDisks

      public static List<HWDiskStore> getDisks()
      Gets the disks on this machine
      Returns:
      a list of HWDiskStore objects representing the disks
    • queryReadWriteStats

      private static WindowsHWDiskStore.DiskStats queryReadWriteStats(String index)
      Gets disk stats for the specified index. If the index is null, populates all the maps
      Parameters:
      index - The index to populate/update maps for
      Returns:
      An object encapsulating maps with the stats
    • queryPartitionMaps

      private static WindowsHWDiskStore.PartitionMaps queryPartitionMaps(WmiQueryHandler h)
    • getIndexFromName

      private static String getIndexFromName(String s)
      Parse a drive name like "0 C:" to just the index "0"
      Parameters:
      s - A drive name to parse
      Returns:
      The first space-delimited value