Package jnr.netdb
Class Protocol
java.lang.Object
jnr.netdb.Protocol
An entry in the system protocol database
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Holds the global lazily-loaded instance of the ProtocolDB -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Collection
<String> All the aliases for this protocolprivate final int
private final String
Official protocol name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Collection
<String> Returns a list of aliases thisProtocol
is also known by.final String
getName()
Returns the official IANA name of thisProtocol
final int
getProto()
Returns the official IANA protocol number for thisProtocol
static final Protocol
getProtocolByName
(String name) Locates a protocol by name.static final Protocol
getProtocolByNumber
(int proto) Locates a protocol by number.private static final ProtocolsDB
Returns the currently loaded ProtocolDBtoString()
-
Field Details
-
protocolName
Official protocol name -
proto
private final int proto -
aliases
All the aliases for this protocol
-
-
Constructor Details
-
Protocol
Protocol(String name, int proto, Collection<String> aliases)
-
-
Method Details
-
getProtocolByName
Locates a protocol by name.- Parameters:
name
- the official IANA name for the protocol, or an alias.- Returns:
- a
Protocol
instance, ornull
if the protocol could not be found.
-
getProtocolByNumber
Locates a protocol by number.- Parameters:
proto
- the internet protocol number of the protocol.- Returns:
- a
Protocol
instance, ornull
if the protocol could not be found.
-
getName
Returns the official IANA name of thisProtocol
- Returns:
- The name of this
Protocol
as aString
-
getProto
public final int getProto()Returns the official IANA protocol number for thisProtocol
- Returns:
- The protocol number for this
Protocol
as anint
-
getAliases
Returns a list of aliases thisProtocol
is also known by.- Returns:
- A
Collection
of Strings for aliases thisProtocol
-
getProtocolDB
Returns the currently loaded ProtocolDB- Returns:
- an instance of
ProtocolDB
-
toString
-