View Javadoc
1   /*
2    * Copyright 2016-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.hardware.common;
6   
7   import java.util.Arrays;
8   
9   import oshi.annotation.concurrent.Immutable;
10  import oshi.hardware.Display;
11  import oshi.util.EdidUtil;
12  
13  /**
14   * A Display
15   */
16  @Immutable
17  public abstract class AbstractDisplay implements Display {
18  
19      private final byte[] edid;
20  
21      /**
22       * Constructor for AbstractDisplay.
23       *
24       * @param edid a byte array representing a display EDID
25       */
26      protected AbstractDisplay(byte[] edid) {
27          this.edid = Arrays.copyOf(edid, edid.length);
28      }
29  
30      @Override
31      public byte[] getEdid() {
32          return Arrays.copyOf(this.edid, this.edid.length);
33      }
34  
35      @Override
36      public String toString() {
37          return EdidUtil.toString(this.edid);
38      }
39  }