Class PortRange


  • public class PortRange
    extends Object
    Immutable class representing a port range.
    Author:
    Gerd Behrmann, Tigran Mkrtchyan
    • Constructor Detail

      • PortRange

        public PortRange​(int low,
                         int high)
        Creates a port range with the given bounds (both inclusive).
        Parameters:
        low - start of port range
        high - end of port range
        Throws:
        IllegalArgumentException - is either bound is not between 1 and 65535, or if high is lower than low.
      • PortRange

        public PortRange​(int port)
        Creates a port range containing a single port.
        Parameters:
        port - port
    • Method Detail

      • valueOf

        public static PortRange valueOf​(String s)
                                 throws IllegalArgumentException
        Parse a port range. A port range consists of either a single integer, or two integers separated by either a comma or a colon. The bounds must be between 1 and 65535, both inclusive.
        Parameters:
        s - either "number" or "number:number"
        Returns:
        The port range represented by s.
        Throws:
        IllegalArgumentException
      • getLower

        public int getLower()
      • getUpper

        public int getUpper()