Class PortNumber


  • public final class PortNumber
    extends Object
    Representation of a port number.
    • Method Detail

      • portNumber

        public static PortNumber portNumber​(long number)
        Returns the port number representing the specified long value.
        Parameters:
        number - port number as long value
        Returns:
        port number
      • portNumber

        public static PortNumber portNumber​(String string)
        Returns the port number representing the specified string value.
        Parameters:
        string - port number as decimal, hexadecimal, or octal number string
        Returns:
        port number
      • portNumber

        public static PortNumber portNumber​(long number,
                                            String name)
        Returns the port number representing the specified long value and name.
        Parameters:
        number - port number as long value
        name - port name as string value
        Returns:
        port number
      • isLogical

        public boolean isLogical()
        Indicates whether or not this port number is a reserved logical one or whether it corresponds to a normal physical port of a device or NIC.
        Returns:
        true if logical port number
      • toLong

        public long toLong()
        Returns the backing long value.
        Returns:
        port number as long
      • name

        public String name()
        Returns the backing string value.
        Returns:
        port name as string value
      • hasName

        public boolean hasName()
        Indicates whether this port number was created with a port name, or only with a number.
        Returns:
        true if port was created with name
      • hashCode

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

        public boolean exactlyEquals​(PortNumber that)
        Indicates whether some other PortNumber object is equal to this one including it's name.
        Parameters:
        that - other PortNumber instance to compare
        Returns:
        true if equal, false otherwise