com.atlassian.jira.util
Class PortUtil

java.lang.Object
  extended by 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 Summary
static int MAX_PORT
           
static int MIN_PORT
           
 
Method Summary
static boolean isValidPort(int port)
          Tells the caller of the passed int represents a valid TCP/UDP port.
static boolean isValidPort(String port)
          Tells the caller of the passed string represents a valid TCP/UDP port.
static int parsePort(String port)
          Return the TCP/UDP port contained in the passed port string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_PORT

public static final int MIN_PORT
See Also:
Constant Field Values

MAX_PORT

public static final int MAX_PORT
See Also:
Constant Field Values
Method Detail

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.


Copyright © 2002-2014 Atlassian. All Rights Reserved.