View Javadoc
1   /*
2    * Copyright 2021-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.hardware.platform.unix;
6   
7   import java.util.List;
8   import java.util.stream.Collectors;
9   
10  import oshi.annotation.concurrent.ThreadSafe;
11  import oshi.driver.unix.Xrandr;
12  import oshi.hardware.Display;
13  import oshi.hardware.common.AbstractDisplay;
14  
15  /**
16   * A Display
17   */
18  @ThreadSafe
19  public final class UnixDisplay extends AbstractDisplay {
20  
21      /**
22       * Constructor for UnixDisplay.
23       *
24       * @param edid a byte array representing a display EDID
25       */
26      UnixDisplay(byte[] edid) {
27          super(edid);
28      }
29  
30      /**
31       * Gets Display Information
32       *
33       * @return An array of Display objects representing monitors, etc.
34       */
35      public static List<Display> getDisplays() {
36          return Xrandr.getEdidArrays().stream().map(UnixDisplay::new).collect(Collectors.toList());
37      }
38  }