Class Host

java.lang.Object
com.norconex.commons.lang.net.Host
All Implemented Interfaces:
Serializable

public final class Host extends Object implements Serializable
Holds a host name and port.
Since:
2.0.0
See Also:
  • Constructor Details

    • Host

      public Host(String name, int port)
  • Method Details

    • getName

      public String getName()
    • getPort

      public int getPort()
    • isSet

      public boolean isSet()
    • withName

      public Host withName(String name)
    • withPort

      public Host withPort(int port)
    • toInetSocketAddress

      public InetSocketAddress toInetSocketAddress()
      Converts this host to an InetSocketAddress if the name is set, otherwise returns null. The port must be greater or equal to zero.
      Returns:
      socket address or null
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object