Class NetworkPortRange

  • All Implemented Interfaces:
    Serializable

    public final class NetworkPortRange
    extends Object
    implements Serializable
    This class represents a port range as specified in the dnsName and ipAddress datatypes. The range may have upper and lower bounds, be specified by a single port number, or may be unbound.
    Version:
    $Id: $
    See Also:
    Serialized Form
    • Field Detail

      • MIN_NET_PORT_NUMBER

        public static final int MIN_NET_PORT_NUMBER
        Minimum network socket port number (decimal).
        See Also:
        Constant Field Values
      • MAX_NET_PORT_NUMBER

        public static final int MAX_NET_PORT_NUMBER
        Maximum network socket port number (decimal).
        See Also:
        Constant Field Values
    • Method Detail

      • getInstance

        public static NetworkPortRange getInstance​(String value)
                                            throws IllegalArgumentException
        Creates an instance of PortRange based on the given value.
        Parameters:
        value - a String representing the range, that may be null or empty for unlimited range, or a valid port range as defined by appendix A.2 for IP address and DNS name.
        Returns:
        a new PortRange
        Throws:
        IllegalArgumentException - if the port range syntax is not: portnumber | "-"portnumber | portnumber"-"[portnumber]; or one of the portnumber values is not a valid decimal number in the interval [0, 65535]
      • getLowerBound

        public int getLowerBound()
        Returns the lower-bound port value. If the range is not lower-bound, then this returns UNBOUND. If the range is actually a single port number, then this returns the same value as getUpperBound.
        Returns:
        the upper-bound
      • getUpperBound

        public int getUpperBound()
        Returns the upper-bound port value. If the range is not upper-bound, then this returns UNBOUND. If the range is actually a single port number, then this returns the same value as getLowerBound.
        Returns:
        the upper-bound
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object o)
        Returns true if the input is an instance of this class and if its value equals the value contained in this class.
        Overrides:
        equals in class Object