Top Description Fields Constructors Methods
org.glassfish.grizzly

public Class PortRange

extends Object
Class Inheritance
Imports
java.util.regex.Matcher, .Pattern

Immutable class representing a port range.
Authors
Gerd Behrmann, Tigran Mkrtchyan

Field Summary

Modifier and TypeField and Description
private static final Pattern
FORMAT

Pattern matching <port>[:<port>]

private final int
private final int

Constructor Summary

AccessConstructor and Description
public
PortRange(final int
start of port range
low
,
final int
end of port range
high
)

Creates a port range with the given bounds (both inclusive).

public
PortRange(final int
port
port
)

Creates a port range containing a single port.

Method Summary

Modifier and TypeMethod and Description
public int
public int
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public static PortRange

Returns:

The port range represented by s.
valueOf
(String
either "number" or "number:number"
s
)

Parse a port range.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

FORMATback to summary
private static final Pattern FORMAT

Pattern matching [:]

lowerback to summary
private final int lower
upperback to summary
private final int upper

Constructor Detail

PortRangeback to summary
public PortRange(final int low, final int high)

Creates a port range with the given bounds (both inclusive).

Parameters
low:int

start of port range

high:int

end of port range

Exceptions
IllegalArgumentException:
is either bound is not between 1 and 65535, or if high is lower than low.
PortRangeback to summary
public PortRange(final int port)

Creates a port range containing a single port.

Parameters
port:int

port

Method Detail

getLowerback to summary
public int getLower()
getUpperback to summary
public int getUpper()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
valueOfback to summary
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:String

either "number" or "number:number"

Returns:PortRange

The port range represented by s.