public final class Protocol
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
Protocol.ProtocolDBSingletonHolder
Holds the global lazily-loaded instance of the ProtocolDB
|
Modifier and Type | Field and Description |
---|---|
private java.util.Collection<java.lang.String> |
aliases
All the aliases for this protocol
|
private int |
proto |
private java.lang.String |
protocolName
Official protocol name
|
Constructor and Description |
---|
Protocol(java.lang.String name,
int proto,
java.util.Collection<java.lang.String> aliases) |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<java.lang.String> |
getAliases()
Returns a list of aliases this
Protocol is also known by. |
java.lang.String |
getName()
Returns the official IANA name of this
Protocol |
int |
getProto()
Returns the official IANA protocol number for this
Protocol |
static Protocol |
getProtocolByName(java.lang.String name)
Locates a protocol by name.
|
static Protocol |
getProtocolByNumber(int proto)
Locates a protocol by number.
|
private static ProtocolsDB |
getProtocolDB()
Returns the currently loaded ProtocolDB
|
java.lang.String |
toString() |
private final java.lang.String protocolName
private final int proto
private final java.util.Collection<java.lang.String> aliases
Protocol(java.lang.String name, int proto, java.util.Collection<java.lang.String> aliases)
public static final Protocol getProtocolByName(java.lang.String name)
name
- the official IANA name for the protocol, or an alias.Protocol
instance, or null
if the protocol could not be found.public static final Protocol getProtocolByNumber(int proto)
proto
- the internet protocol number of the protocol.Protocol
instance, or null
if the protocol could not be found.public final java.lang.String getName()
Protocol
Protocol
as a String
public final int getProto()
Protocol
Protocol
as an int
public final java.util.Collection<java.lang.String> getAliases()
Protocol
is also known by.Collection
of Strings for aliases this Protocol
private static final ProtocolsDB getProtocolDB()
ProtocolDB
public java.lang.String toString()
toString
in class java.lang.Object