java.lang.Object
com.aoapps.net.IPortRange
com.aoapps.net.PortRange
- All Implemented Interfaces:
DtoFactory<PortRange>
,Serializable
,Comparable<IPortRange>
A port range and associated protocol.
The range must represent at least two ports.
- Author:
- AO Industries, Inc.
- See Also:
-
Field Summary
Fields inherited from class com.aoapps.net.IPortRange
MAX_PORT, MIN_PORT
-
Method Summary
Modifier and TypeMethodDescriptionboolean
UnlikePort
, port ranges are not cached and may not be safely compared by identity.getDto()
int
getFrom()
Gets the first port number in the range.Gets the first port number in the range as aPort
.int
getTo()
Gets the last port number in the range.Gets the last port number in the range as aPort
.int
hashCode()
splitAbove
(int above) splitBelow
(int below) toString()
static ValidationResult
static PortRange
Methods inherited from class com.aoapps.net.IPortRange
coalesce, compareTo, getProtocol, overlaps
-
Method Details
-
validate
-
valueOf
- Throws:
ValidationException
-
equals
UnlikePort
, port ranges are not cached and may not be safely compared by identity.- Specified by:
equals
in classIPortRange
-
hashCode
public int hashCode()- Specified by:
hashCode
in classIPortRange
-
toString
- Specified by:
toString
in classIPortRange
- Returns:
- The port range and protocol, such as
53/UDP
or8080-8087/TCP
. - See Also:
-
getFrom
public int getFrom()Description copied from class:IPortRange
Gets the first port number in the range.- Specified by:
getFrom
in classIPortRange
-
getFromPort
Description copied from class:IPortRange
Gets the first port number in the range as aPort
.- Specified by:
getFromPort
in classIPortRange
-
getTo
public int getTo()Description copied from class:IPortRange
Gets the last port number in the range.- Specified by:
getTo
in classIPortRange
-
getToPort
Description copied from class:IPortRange
Gets the last port number in the range as aPort
.- Specified by:
getToPort
in classIPortRange
-
getDto
- Specified by:
getDto
in interfaceDtoFactory<PortRange>
-
splitBelow
- Specified by:
splitBelow
in classIPortRange
- Returns:
- The part of this port range below, and not including, the given port or
null
if none.
-
splitAbove
- Specified by:
splitAbove
in classIPortRange
- Returns:
- The part of this port range above, and not including, the given port or
null
if none.
-