Class DisplayInfoImpl

java.lang.Object
oshi.hardware.DisplayInfoImpl
All Implemented Interfaces:
DisplayInfo

@ThreadSafe public class DisplayInfoImpl extends Object implements DisplayInfo
The default DisplayInfo implementation. This is not part of the OSHI public API and may change between minor releases.

An instance is created either from a raw EDID byte array (fields decoded from the EDID on demand) or from individual field values, in which case isEdidSynthetic() is true and getEdid() lazily synthesizes an EDID from the supplied fields. The synthetic serial number must be in a form accepted by EdidUtil.setSerialNo(byte[], String) (8 hex characters or 4 printable characters).

  • Constructor Details

    • DisplayInfoImpl

      public DisplayInfoImpl(byte[] edid)
      Constructs a DisplayInfoImpl from a raw EDID byte array. The fields are parsed from the EDID on demand.
      Parameters:
      edid - The raw EDID byte array as reported by the display.
    • DisplayInfoImpl

      public DisplayInfoImpl(String manufacturerID, String productID, String serialNo, byte week, int year, String version, boolean digital, int hcm, int vcm, String preferredResolution, String model, String productSerialNumber)
      Constructs a synthetic DisplayInfoImpl from individual field values, for displays that report their attributes without providing an EDID. The EDID returned by getEdid() is synthesized on demand from these values, and isEdidSynthetic() returns true.
      Parameters:
      manufacturerID - The three-letter manufacturer ID (see EdidUtil.getManufacturerID(byte[])).
      productID - The product ID as a hex string (see EdidUtil.getProductID(byte[])).
      serialNo - The serial number, either 8 hex characters or 4 printable characters (see EdidUtil.getSerialNo(byte[])).
      week - The week of manufacture.
      year - The four-digit year of manufacture.
      version - The EDID version as a major.minor string (e.g. "1.4").
      digital - Whether the display is digital.
      hcm - The monitor width in cm.
      vcm - The monitor height in cm.
      preferredResolution - The preferred resolution as a WIDTHxHEIGHT string (e.g. "2560x1440").
      model - The monitor model.
      productSerialNumber - The display product serial number (the serial-number descriptor text, distinct from serialNo); null or empty if not available.
  • Method Details

    • getEdid

      public byte[] getEdid()
      Description copied from interface: DisplayInfo
      Gets the EDID byte array: the bytes reported by the display, or, when DisplayInfo.isEdidSynthetic() is true, an EDID synthesized from the display's reported attributes.
      Specified by:
      getEdid in interface DisplayInfo
      Returns:
      A copy of the EDID byte array.
    • isEdidSynthetic

      public boolean isEdidSynthetic()
      Description copied from interface: DisplayInfo
      Indicates whether the EDID returned by DisplayInfo.getEdid() was synthesized from reported attributes rather than read directly from the display.
      Specified by:
      isEdidSynthetic in interface DisplayInfo
      Returns:
      true if the EDID is synthetic, false if it is the display's raw EDID.
    • getManufacturerID

      public String getManufacturerID()
      Description copied from interface: DisplayInfo
      Gets the manufacturer ID.
      Specified by:
      getManufacturerID in interface DisplayInfo
      Returns:
      The manufacturer ID.
    • getProductID

      public String getProductID()
      Description copied from interface: DisplayInfo
      Gets the product ID.
      Specified by:
      getProductID in interface DisplayInfo
      Returns:
      The product ID.
    • getSerialNo

      public String getSerialNo()
      Description copied from interface: DisplayInfo
      Gets the serial number, the numeric ID serial number from bytes 12-15 of the EDID. This is distinct from DisplayInfo.getProductSerialNumber().
      Specified by:
      getSerialNo in interface DisplayInfo
      Returns:
      The serial number.
    • getWeek

      public byte getWeek()
      Description copied from interface: DisplayInfo
      Gets the week of manufacture.
      Specified by:
      getWeek in interface DisplayInfo
      Returns:
      The week of manufacture.
    • getYear

      public int getYear()
      Description copied from interface: DisplayInfo
      Gets the year of manufacture.
      Specified by:
      getYear in interface DisplayInfo
      Returns:
      The year of manufacture.
    • getVersion

      public String getVersion()
      Description copied from interface: DisplayInfo
      Gets the EDID version.
      Specified by:
      getVersion in interface DisplayInfo
      Returns:
      The EDID version.
    • isDigital

      public boolean isDigital()
      Description copied from interface: DisplayInfo
      Tests whether the display is digital.
      Specified by:
      isDigital in interface DisplayInfo
      Returns:
      true if the display is digital, false otherwise.
    • getHcm

      public int getHcm()
      Description copied from interface: DisplayInfo
      Gets the monitor width in cm.
      Specified by:
      getHcm in interface DisplayInfo
      Returns:
      The monitor width in cm.
    • getVcm

      public int getVcm()
      Description copied from interface: DisplayInfo
      Gets the monitor height in cm.
      Specified by:
      getVcm in interface DisplayInfo
      Returns:
      The monitor height in cm.
    • getPreferredResolution

      public String getPreferredResolution()
      Description copied from interface: DisplayInfo
      Gets the preferred resolution.
      Specified by:
      getPreferredResolution in interface DisplayInfo
      Returns:
      The preferred resolution (e.g. "2560x1440").
    • getModel

      public String getModel()
      Description copied from interface: DisplayInfo
      Gets the monitor model.
      Specified by:
      getModel in interface DisplayInfo
      Returns:
      The monitor model.
    • getProductSerialNumber

      public String getProductSerialNumber()
      Description copied from interface: DisplayInfo
      Gets the display product serial number, the text of the serial-number descriptor. This is distinct from DisplayInfo.getSerialNo(), which returns the numeric ID serial number.
      Specified by:
      getProductSerialNumber in interface DisplayInfo
      Returns:
      The display product serial number, or an empty string if not available.
    • toString

      public String toString()
      Overrides:
      toString in class Object