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 TypeMethodDescriptionbooleanPortinstances are cached and may be safely compared by identity.getDto()intgetFrom()Gets the first port number in the range.Gets the first port number in the range as aPort.intgetPort()intgetTo()Gets the last port number in the range.Gets the last port number in the range as aPort.inthashCode()booleanisUser()Determines if this is a port that may be bound by non-root processes.splitAbove(int above) splitBelow(int below) toString()static ValidationResultstatic PortMethods inherited from class com.aoapps.net.IPortRange
coalesce, compareTo, getProtocol, overlaps, validate, valueOf
-
Method Details
-
validate
-
valueOf
- Throws:
ValidationException
-
equals
Portinstances are cached and may be safely compared by identity.- Specified by:
equalsin classIPortRange
-
hashCode
public int hashCode()- Specified by:
hashCodein classIPortRange
-
toString
- Specified by:
toStringin classIPortRange- Returns:
- The port and protocol, such as 110/TCP.
- See Also:
-
getFrom
public int getFrom()Description copied from class:IPortRangeGets the first port number in the range.- Specified by:
getFromin classIPortRange
-
getFromPort
Description copied from class:IPortRangeGets the first port number in the range as aPort.- Specified by:
getFromPortin classIPortRange
-
getTo
public int getTo()Description copied from class:IPortRangeGets the last port number in the range.- Specified by:
getToin classIPortRange
-
getToPort
Description copied from class:IPortRangeGets the last port number in the range as aPort.- Specified by:
getToPortin classIPortRange
-
getPort
public int getPort() -
isUser
public boolean isUser()Determines if this is a port that may be bound by non-root processes.- Returns:
truewhen the port is>= 1024.
-
getDto
- Specified by:
getDtoin interfaceDtoFactory<Port>
-
splitBelow
- Specified by:
splitBelowin classIPortRange- Returns:
- The part of this port range below, and not including, the given port or
nullif none.
-
splitAbove
- Specified by:
splitAbovein classIPortRange- Returns:
- The part of this port range above, and not including, the given port or
nullif none.
-
