com.atlassian.jira.util
Class PortUtil

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

public final class PortUtil
extends java.lang.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(java.lang.String port)
          Tells the caller of the passed string represents a valid TCP/UDP port.
static int parsePort(java.lang.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(java.lang.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(java.lang.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-2010 Atlassian. All Rights Reserved.