public final class ICMPv4Type extends CacheableDataType implements Comparable<ICMPv4Type>
All constructors for this class are private. Creating instances of
ICMPv4Type
is done via the static methods on the class.
Instances of this class are immutable, making them inherently threadsafe.
This class overrides equals(java.lang.Object)
and hashCode()
so that instances
play nicely with the Collection classes.
This class implements the Comparable
interface to ensure that a
sorted list of types is presented in an intuitive order.
Modifier and Type | Field and Description |
---|---|
static ICMPv4Type |
ECHO_REP
The instance representing Echo reply.
|
static ICMPv4Type |
ECHO_REQ
The instance representing Echo request.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ICMPv4Type o)
Implements the Comparable interface, to return ICMPv4 message types in
natural order.
|
boolean |
equals(Object o) |
int |
getCode()
Returns the ICMPv4 message type code.
|
String |
getDescription()
Returns the description of the ICMPv4 message type.
|
String |
getName()
Returns the (short) name of the message type.
|
int |
hashCode() |
boolean |
isReserved()
Returns true if the message type code is one of the reserved
values.
|
boolean |
isUnknown()
Returns true if the message type code is not one of the "named"
types.
|
String |
toString()
Returns a string representing the ICMPv4 message type.
|
static ICMPv4Type |
valueOf(int typeCode)
Returns an object that represents the value of the ICMPv4 message type
identified by the specified type code.
|
static ICMPv4Type |
valueOf(String value)
Returns an object that represents the value of the ICMPv4 message type
identified by the specified string.
|
getRefQ, keyFromBytes
public static final ICMPv4Type ECHO_REQ
public static final ICMPv4Type ECHO_REP
public String toString()
public String getDescription()
public String getName()
public int getCode()
public boolean isUnknown()
reserved
.public boolean isReserved()
public int compareTo(ICMPv4Type o)
compareTo
in interface Comparable<ICMPv4Type>
o
- the other IP Protocol instanceComparable.compareTo(T)
public static ICMPv4Type valueOf(String value)
ICMPv4Type rs = ICMPv4Type.valueOf("rtr_sol"); String s = rs.getDescription(); // "RTR_SOL : Router Solicitation" ICMPv4Type rsAlso = ICMPv4Type.valueOf(s); assert rsAlso.equals(rs);
value
- the message type identifierpublic static ICMPv4Type valueOf(int typeCode)
typeCode
- the ICMPv4 message type codeIllegalArgumentException
- if the parameter is < 0 or > 255Copyright © 2015. All Rights Reserved.