Package org.glassfish.grizzly
Class PortRange
- java.lang.Object
-
- org.glassfish.grizzly.PortRange
-
public class PortRange extends Object
Immutable class representing a port range.- Author:
- Gerd Behrmann, Tigran Mkrtchyan
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getLower()
int
getUpper()
String
toString()
static PortRange
valueOf(String s)
Parse a port range.
-
-
-
Constructor Detail
-
PortRange
public PortRange(int low, int high)
Creates a port range with the given bounds (both inclusive).- Parameters:
low
- start of port rangehigh
- end of port range- Throws:
IllegalArgumentException
- is either bound is not between 1 and 65535, or ifhigh
is lower thanlow
.
-
PortRange
public PortRange(int port)
Creates a port range containing a single port.- Parameters:
port
- port
-
-
Method Detail
-
valueOf
public static PortRange valueOf(String s) throws IllegalArgumentException
Parse a port range. A port range consists of either a single integer, or two integers separated by either a comma or a colon. The bounds must be between 1 and 65535, both inclusive.- Parameters:
s
- either "number" or "number:number"- Returns:
- The port range represented by
s
. - Throws:
IllegalArgumentException
-
getLower
public int getLower()
-
getUpper
public int getUpper()
-
-