Package jnr.netdb
Class Service
- java.lang.Object
-
- jnr.netdb.Service
-
public final class Service extends java.lang.ObjectHolds information about TCP and UDP services on a host.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Collection<java.lang.String>getAliases()Gets a list of aliases thisServiceis also known as.static java.util.Collection<Service>getAllServices()Returns a list of all services.java.lang.StringgetName()Returns the official IANA name of thisServiceintgetPort()Returns the official IANA port for thisServicestatic ServicegetServiceByName(java.lang.String name, java.lang.String proto)Locates a service by name and protocol.static ServicegetServiceByPort(int port, java.lang.String proto)Locates a service by port and protocol.java.lang.StringtoString()
-
-
-
Method Detail
-
getServiceByName
public static final Service getServiceByName(java.lang.String name, java.lang.String proto)
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
public static final Service getServiceByPort(int port, java.lang.String proto)
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
public static final java.util.Collection<Service> getAllServices()
Returns a list of all services.- Returns:
- a
CollectionofServiceinstances.
-
getName
public final java.lang.String 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
public final java.util.Collection<java.lang.String> getAliases()
Gets a list of aliases thisServiceis also known as.- Returns:
- A
Collectionof Strings for aliases thisService
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-