Package jnr.netdb
Class Service
java.lang.Object
jnr.netdb.Service
Holds information about TCP and UDP services on a host.
-
Method Summary
Modifier and TypeMethodDescriptionfinal Collection<String> Gets a list of aliases thisServiceis also known as.static final Collection<Service> Returns a list of all services.final StringgetName()Returns the official IANA name of thisServicefinal intgetPort()Returns the official IANA port for thisServicestatic final ServicegetServiceByName(String name, String proto) Locates a service by name and protocol.static final ServicegetServiceByPort(int port, String proto) Locates a service by port and protocol.toString()
-
Method Details
-
getServiceByName
Locates a service by name and protocol.- Parameters:
name- the official IANA name for the service, or an alias.proto- the protocol for the service. Usually "tcp" or "udp".- Returns:
- a
Serviceinstance, ornullif the service could not be found.
-
getServiceByPort
Locates a service by port and protocol.- Parameters:
port- the TCP or UDP port of the service.proto- the protocol for the service. Usually "tcp" or "udp".- Returns:
- a
Serviceinstance, ornullif the service could not be found.
-
getAllServices
Returns a list of all services.- Returns:
- a
CollectionofServiceinstances.
-
getName
Returns the official IANA name of thisService- Returns:
- The name of this
Serviceas aString
-
getPort
public final int getPort()Returns the official IANA port for thisService- Returns:
- The port for this
Serviceas anint
-
getAliases
Gets a list of aliases thisServiceis also known as.- Returns:
- A
Collectionof Strings for aliases thisService
-
toString
-