public class PortRange extends Object
dnsName
and ipAddress
. The range may have
upper and lower bounds, be specified by a single port number, or may be
unbound.Modifier and Type | Field and Description |
---|---|
static int |
UNBOUND
Constant used to specify that the range is unbound on one side.
|
Constructor and Description |
---|
PortRange()
Default constructor used to represent an unbound range.
|
PortRange(int singlePort)
Creates a
PortRange that represents a single port value
instead of a range of values. |
PortRange(int lowerBound,
int upperBound)
Creates a
PortRange with upper and lower bounds. |
Modifier and Type | Method and Description |
---|---|
String |
encode() |
boolean |
equals(Object o)
Returns true if the input is an instance of this class and if its
value equals the value contained in this class.
|
static PortRange |
getInstance(String value)
Creates an instance of
PortRange based on the given value. |
int |
getLowerBound()
Returns the lower-bound port value.
|
int |
getUpperBound()
Returns the upper-bound port value.
|
boolean |
isLowerBounded()
Returns whether the range is bounded by a lower port number.
|
boolean |
isSinglePort()
Returns whether the range is actually a single port number.
|
boolean |
isUnbound()
Returns whether the range is unbound, which means that it specifies
no port number or range.
|
boolean |
isUpperBounded()
Returns whether the range is bounded by an upper port number.
|
public static final int UNBOUND
public PortRange()
public PortRange(int singlePort)
PortRange
that represents a single port value
instead of a range of values.singlePort
- the single port numberpublic PortRange(int lowerBound, int upperBound)
PortRange
with upper and lower bounds. Either
of the parameters may have the value UNBOUND
meaning
that there is no bound at the respective end.lowerBound
- the lower-bound port number or UNBOUND
upperBound
- the upper-bound port number or UNBOUND
public static PortRange getInstance(String value)
PortRange
based on the given value.value
- a String
representing the rangePortRange
NumberFormatException
- if a port value isn't an integerpublic int getLowerBound()
UNBOUND
. If the range is actually a
single port number, then this returns the same value as
getUpperBound
.public int getUpperBound()
UNBOUND
. If the range is actually a
single port number, then this returns the same value as
getLowerBound
.public boolean isLowerBounded()
public boolean isUpperBounded()
public boolean isSinglePort()
public boolean isUnbound()
public boolean equals(Object o)
public String encode()
Copyright © 2023 JBoss by Red Hat. All rights reserved.