java.lang.Object
com.aoapps.net.IPortRange
com.aoapps.net.Port
- All Implemented Interfaces:
DtoFactory<Port>
,Serializable
,Comparable<IPortRange>
Several network resources on a
Server
require a unique
port. All of the possible network ports are represented by
Port
.- 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
Port
instances are cached and may 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
getPort()
int
getTo()
Gets the last port number in the range.Gets the last port number in the range as aPort
.int
hashCode()
boolean
isUser()
Determines if this is a port that may be bound by non-root processes.splitAbove
(int above) splitBelow
(int below) toString()
static ValidationResult
static Port
Methods inherited from class com.aoapps.net.IPortRange
coalesce, compareTo, getProtocol, overlaps, validate, valueOf
-
Method Details
-
validate
-
valueOf
- Throws:
ValidationException
-
equals
Port
instances are cached and may 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 and protocol, such as 110/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
-
getPort
public int getPort() -
isUser
public boolean isUser()Determines if this is a port that may be bound by non-root processes.- Returns:
true
when the port is>= 1024
.
-
getDto
- Specified by:
getDto
in interfaceDtoFactory<Port>
-
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.
-