Package jssc

Class SerialPortList

java.lang.Object
jssc.SerialPortList

public class SerialPortList extends Object
  • Constructor Details

    • SerialPortList

      public SerialPortList()
  • Method Details

    • getPortNames

      public static String[] getPortNames()
      Get sorted array of serial ports in the system using default settings:
      Search path
      Windows - ""(always ignored)
      Linux - "/dev/"
      Solaris - "/dev/term/"
      MacOSX - "/dev/"
      RegExp
      Windows - ""
      Linux - "(ttyS|ttyUSB|ttyACM|ttyAMA|rfcomm)[0-9]{1,3}"
      Solaris - "[0-9]*|[a-z]*"
      MacOSX - "tty.(serial|usbserial|usbmodem).*"
      Returns:
      String array. If there is no ports in the system String[] with zero length will be returned (since jSSC-0.8 in previous versions null will be returned)
    • getPortNames

      public static String[] getPortNames(String searchPath)
      Get sorted array of serial ports in the system located on searchPath
      Parameters:
      searchPath - Path for searching serial ports (not null)
      The default search paths:
      Linux, MacOSX: /dev/
      Solaris: /dev/term/
      Windows: this parameter ingored
      Returns:
      String array. If there is no ports in the system String[]
      Since:
      2.3.0
    • getPortNames

      public static String[] getPortNames(Pattern pattern)
      Get sorted array of serial ports in the system matched pattern
      Parameters:
      pattern - RegExp pattern for matching port names (not null)
      Returns:
      String array. If there is no ports in the system String[]
      Since:
      2.3.0
    • getPortNames

      public static String[] getPortNames(Comparator<String> comparator)
      Get sorted array of serial ports in the system matched pattern
      Parameters:
      comparator - Comparator for sotring port names (not null)
      Returns:
      String array. If there is no ports in the system String[]
      Since:
      2.3.0
    • getPortNames

      public static String[] getPortNames(String searchPath, Pattern pattern)
      Get sorted array of serial ports in the system located on searchPath, matched pattern
      Parameters:
      searchPath - Path for searching serial ports (not null)
      The default search paths:
      Linux, MacOSX: /dev/
      Solaris: /dev/term/
      Windows: this parameter ingored
      pattern - RegExp pattern for matching port names (not null)
      Returns:
      String array. If there is no ports in the system String[]
      Since:
      2.3.0
    • getPortNames

      public static String[] getPortNames(String searchPath, Comparator<String> comparator)
      Get sorted array of serial ports in the system located on searchPath and sorted by comparator
      Parameters:
      searchPath - Path for searching serial ports (not null)
      The default search paths:
      Linux, MacOSX: /dev/
      Solaris: /dev/term/
      Windows: this parameter ingored
      comparator - Comparator for sotring port names (not null)
      Returns:
      String array. If there is no ports in the system String[]
      Since:
      2.3.0
    • getPortNames

      public static String[] getPortNames(Pattern pattern, Comparator<String> comparator)
      Get sorted array of serial ports in the system matched pattern and sorted by comparator
      Parameters:
      pattern - RegExp pattern for matching port names (not null)
      comparator - Comparator for sotring port names (not null)
      Returns:
      String array. If there is no ports in the system String[]
      Since:
      2.3.0
    • getPortNames

      public static String[] getPortNames(String searchPath, Pattern pattern, Comparator<String> comparator)
      Get sorted array of serial ports in the system located on searchPath, matched pattern and sorted by comparator
      Parameters:
      searchPath - Path for searching serial ports (not null)
      The default search paths:
      Linux, MacOSX: /dev/
      Solaris: /dev/term/
      Windows: this parameter ingored
      pattern - RegExp pattern for matching port names (not null)
      comparator - Comparator for sotring port names (not null)
      Returns:
      String array. If there is no ports in the system String[]
      Since:
      2.3.0