Package jnr.netdb

Class Protocol

java.lang.Object
jnr.netdb.Protocol

public final class Protocol extends Object
An entry in the system protocol database
  • Field Details

    • protocolName

      private final String protocolName
      Official protocol name
    • proto

      private final int proto
    • aliases

      private final Collection<String> aliases
      All the aliases for this protocol
  • Constructor Details

  • Method Details

    • getProtocolByName

      public static final Protocol getProtocolByName(String name)
      Locates a protocol by name.
      Parameters:
      name - the official IANA name for the protocol, or an alias.
      Returns:
      a Protocol instance, or null if the protocol could not be found.
    • getProtocolByNumber

      public static final Protocol getProtocolByNumber(int proto)
      Locates a protocol by number.
      Parameters:
      proto - the internet protocol number of the protocol.
      Returns:
      a Protocol instance, or null if the protocol could not be found.
    • getName

      public final String getName()
      Returns the official IANA name of this Protocol
      Returns:
      The name of this Protocol as a String
    • getProto

      public final int getProto()
      Returns the official IANA protocol number for this Protocol
      Returns:
      The protocol number for this Protocol as an int
    • getAliases

      public final Collection<String> getAliases()
      Returns a list of aliases this Protocol is also known by.
      Returns:
      A Collection of Strings for aliases this Protocol
    • getProtocolDB

      private static final ProtocolsDB getProtocolDB()
      Returns the currently loaded ProtocolDB
      Returns:
      an instance of ProtocolDB
    • toString

      public String toString()
      Overrides:
      toString in class Object