Package oshi.hardware

Class HWDiskStore

java.lang.Object
oshi.hardware.HWDiskStore
All Implemented Interfaces:
java.lang.Comparable<HWDiskStore>

@NotThreadSafe
public class HWDiskStore
extends java.lang.Object
implements java.lang.Comparable<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 if both threads only use getters on both this object and the partitions returned by getPartitions(), or if setter usage (including on the partitions) is externally synchronized.

  • Constructor Summary

    Constructors 
    Constructor Description
    HWDiskStore()
    Create an object with empty/default values
    HWDiskStore​(HWDiskStore diskStore)
    Copy constructor
  • Method Summary

    Modifier and Type Method Description
    int compareTo​(HWDiskStore store)  
    boolean equals​(java.lang.Object obj)  
    long getCurrentQueueLength()
    Getter for the field currentQueueLength.
    java.lang.String getModel()
    Getter for the field model.
    java.lang.String getName()
    Getter for the field name.
    HWPartition[] getPartitions()
    Getter for the field partitions.
    long getReadBytes()
    Getter for the field readBytes.
    long getReads()
    Getter for the field reads.
    java.lang.String getSerial()
    Getter for the field serial.
    long getSize()
    Getter for the field size.
    long getTimeStamp()
    Getter for the field timeStamp.
    long getTransferTime()
    Getter for the field transferTime.
    long getWriteBytes()
    Getter for the field writeBytes.
    long getWrites()
    Getter for the field writes.
    int hashCode()  
    void setCurrentQueueLength​(long currentQueueLength)
    Setter for the field currentQueueLength.
    void setModel​(java.lang.String model)
    Setter for the field model.
    void setName​(java.lang.String name)
    Setter for the field name.
    void setPartitions​(HWPartition[] partitions)
    Setter for the field partitions.
    void setReadBytes​(long readBytes)
    Setter for the field readBytes.
    void setReads​(long reads)
    Setter for the field reads.
    void setSerial​(java.lang.String serial)
    Setter for the field serial.
    void setSize​(long size)
    Setter for the field size.
    void setTimeStamp​(long timeStamp)
    Setter for the field timeStamp.
    void setTransferTime​(long transferTime)
    Setter for the field transferTime.
    void setWriteBytes​(long writeBytes)
    Setter for the field writeBytes.
    void setWrites​(long writes)
    Setter for the field writes.
    java.lang.String toString()  
    boolean updateAtrributes()
    Make a best effort to update all the statistics about the drive without needing to recreate the drive list.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • HWDiskStore

      public HWDiskStore()
      Create an object with empty/default values
    • HWDiskStore

      public HWDiskStore​(HWDiskStore diskStore)
      Copy constructor
      Parameters:
      diskStore - The object to copy
  • Method Details

    • updateAtrributes

      public boolean updateAtrributes()
      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 drive statistics. 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
    • getName

      public java.lang.String getName()

      Getter for the field name.

      Returns:
      the name
    • getModel

      public java.lang.String getModel()

      Getter for the field model.

      Returns:
      the model
    • getSerial

      public java.lang.String getSerial()

      Getter for the field serial.

      Returns:
      the serial
    • getSize

      public long getSize()

      Getter for the field size.

      Returns:
      Get size of disk (in bytes)
    • getReads

      public long getReads()

      Getter for the field reads.

      Returns:
      the reads
    • getReadBytes

      public long getReadBytes()

      Getter for the field readBytes.

      Returns:
      the bytes read
    • getWrites

      public long getWrites()

      Getter for the field writes.

      Returns:
      the writes
    • getWriteBytes

      public long getWriteBytes()

      Getter for the field writeBytes.

      Returns:
      the bytes written
    • getCurrentQueueLength

      public long getCurrentQueueLength()

      Getter for the field currentQueueLength.

      Returns:
      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.
    • getTransferTime

      public long getTransferTime()

      Getter for the field transferTime.

      Returns:
      the milliseconds spent reading or writing
    • getPartitions

      public HWPartition[] getPartitions()

      Getter for the field partitions.

      Returns:
      Returns the partitions on this drive.
    • getTimeStamp

      public long getTimeStamp()

      Getter for the field timeStamp.

      Returns:
      Returns the timeStamp.
    • setName

      public void setName​(java.lang.String name)

      Setter for the field name.

      Parameters:
      name - the name to set
    • setModel

      public void setModel​(java.lang.String model)

      Setter for the field model.

      Parameters:
      model - the model to set
    • setSerial

      public void setSerial​(java.lang.String serial)

      Setter for the field serial.

      Parameters:
      serial - the serial to set
    • setSize

      public void setSize​(long size)

      Setter for the field size.

      Parameters:
      size - Set size of disk (in bytes)
    • setReads

      public void setReads​(long reads)

      Setter for the field reads.

      Parameters:
      reads - the reads to set
    • setReadBytes

      public void setReadBytes​(long readBytes)

      Setter for the field readBytes.

      Parameters:
      readBytes - the bytes read to set
    • setWrites

      public void setWrites​(long writes)

      Setter for the field writes.

      Parameters:
      writes - the writes to set
    • setWriteBytes

      public void setWriteBytes​(long writeBytes)

      Setter for the field writeBytes.

      Parameters:
      writeBytes - the bytes written to set
    • setCurrentQueueLength

      public void setCurrentQueueLength​(long currentQueueLength)

      Setter for the field currentQueueLength.

      Parameters:
      currentQueueLength - the length of the disk queue (#I/O's in progress) to set
    • setTransferTime

      public void setTransferTime​(long transferTime)

      Setter for the field transferTime.

      Parameters:
      transferTime - milliseconds spent reading or writing to set
    • setPartitions

      public void setPartitions​(HWPartition[] partitions)

      Setter for the field partitions.

      Parameters:
      partitions - The partitions to set.
    • setTimeStamp

      public void setTimeStamp​(long timeStamp)

      Setter for the field timeStamp.

      Parameters:
      timeStamp - The timeStamp to set.
    • compareTo

      public int compareTo​(HWDiskStore store)
      Specified by:
      compareTo in interface java.lang.Comparable<HWDiskStore>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object