Interface PortHub<PORT extends Port<PM>,PM extends PortMetrics>

Type Parameters:
PORT - The actual Port type to use.
PM - The actual PortMetrics type to use.
All Known Implementing Classes:
CrossoverLoopbackPortHub, LoopbackPortHub

public interface PortHub<PORT extends Port<PM>,PM extends PortMetrics>
A PortHub implementation is used to retrieve Port instances of a given type (e.g. TTY-/COM-Ports).
  • Method Summary

    Modifier and Type
    Method
    Description
    Lists the available ports of the system.
    default PORT[]
    ports(String aPattern)
    Returns the available ports of the system which's AliasAccessor.getAlias() matches the given pattern.
    default PORT
    toPort(String aAlias)
    Returns the Port identified by the given alias.
    toPort(String aAlias, PM aPortMetrics)
    Returns the Port identified by the given alias.
  • Method Details

    • ports

      PORT[] ports() throws IOException
      Lists the available ports of the system.
      Returns:
      An array of available Port instances, if there are no ports than an empty array (size 0) is returned.
      Throws:
      IOException - Thrown in case accessing the list of Port instances failed due to I/O problems.
    • toPort

      default PORT toPort(String aAlias) throws IOException
      Returns the Port identified by the given alias.
      Parameters:
      aAlias - The alias identifying the given Port.
      Returns:
      The given Port.
      Throws:
      IOException - Thrown in case accessing the list of Port instances failed due to I/O problems.
    • toPort

      PORT toPort(String aAlias, PM aPortMetrics) throws IOException
      Returns the Port identified by the given alias.
      Parameters:
      aAlias - The alias identifying the given Port.
      aPortMetrics - The PortMetrics to use when opening the port without providing any specific arguments.
      Returns:
      The given Port.
      Throws:
      IOException - Thrown in case accessing the list of Port instances failed due to I/O problems.
    • ports

      default PORT[] ports(String aPattern) throws IOException
      Returns the available ports of the system which's AliasAccessor.getAlias() matches the given pattern.
      Parameters:
      aPattern - The pattern of the AliasAccessor.getAlias() to match. A "*" stands for any chars, "?" stands for a single name (similar to filename wildcards).
      Returns:
      An array of available Port instances which's AliasAccessor.getAlias() matches the given pattern or an empty array (size = 0) if there are none such ports.
      Throws:
      IOException - Thrown in case accessing the list of Port instances failed due to I/O problems.