Class PortUtil

java.lang.Object
com.atlassian.jira.util.PortUtil

@PublicApi public final class PortUtil extends Object
Class that validates the value of a TCP/UDP port.
Since:
v4.0
  • Field Details

  • Method Details

    • parsePort

      public static int parsePort(String port)
      Return the TCP/UDP port contained in the passed port string. Returns -1 if the passed string is not a valid port.
      Parameters:
      port - the string to get the port from.
      Returns:
      a valid port if the string contains a valid port, or -1 otherwise.
    • isValidPort

      public static boolean isValidPort(String port)
      Tells the caller of the passed string represents a valid TCP/UDP port.
      Parameters:
      port - the string to check.
      Returns:
      true if the passed string is a valid port or false otherwise.
    • isValidPort

      public static boolean isValidPort(int port)
      Tells the caller of the passed int represents a valid TCP/UDP port.
      Parameters:
      port - the int to check.
      Returns:
      true if the passed string is a valid port or false otherwise.