public enum PortType extends Enum<PortType> implements Comparable<PortType>
Enum Constant and Description |
---|
ANY
Any port
|
DYNAMIC
The dynamic ports (aka private or ephemeral ports), these are ports
49152 to 65535 which are never assigned by the IANA |
OS_ALLOCATED
Port
0 i.e. |
SYSTEM
The system (aka well known or privileged ports), these are ports
1 to 1023 and usually require adminstrative privileges |
USER
The user ports (aka registered ports), these are ports
1024 to
49151 and which may be registered and assigned by the IANA |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(PortType other)
Gets whether the port type contains another port type i.e.
|
int |
getMaximumPort()
Gets the maximum port
|
int |
getMinimumPort()
Gets the minimum port
|
boolean |
inRange(int port)
Gets whether a port falls within the range of this port type
|
static String |
toRangesString(Iterable<PortType> portTypes)
Gets a string denoting all the acceptable port ranges
|
String |
toString() |
static PortType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static PortType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
compareTo
public static final PortType ANY
public static final PortType OS_ALLOCATED
0
i.e. the special port that has the OS allocate an
available portpublic static final PortType SYSTEM
1
to 1023
and usually require adminstrative privilegespublic static final PortType USER
1024
to
49151
and which may be registered and assigned by the IANApublic static final PortType DYNAMIC
49152
to 65535
which are never assigned by the IANApublic static PortType[] values()
for (PortType c : PortType.values()) System.out.println(c);
public static PortType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant
with the specified nameNullPointerException
- if the argument is nullpublic int getMinimumPort()
public int getMaximumPort()
public boolean inRange(int port)
port
- Portpublic boolean contains(PortType other)
other
- Other port typeCopyright © 2012–2017. All rights reserved.