Class Host

  • All Implemented Interfaces:
    java.io.Serializable, NamedEndpoint

    @Contract(threading=IMMUTABLE)
    public final class Host
    extends java.lang.Object
    implements NamedEndpoint, java.io.Serializable
    Component that holds all details needed to describe a network connection to a host. This includes remote host name and port.
    Since:
    5.0
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String lcName  
      private java.lang.String name  
      private int port  
      private static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Constructor Description
      Host​(java.lang.String name, int port)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Host create​(java.lang.String s)  
      boolean equals​(java.lang.Object o)  
      (package private) static void format​(java.lang.StringBuilder buf, Host host)  
      (package private) static void format​(java.lang.StringBuilder buf, NamedEndpoint endpoint)  
      (package private) static java.lang.String format​(Host host)  
      java.lang.String getHostName()
      Returns name (IP or DNS name).
      int getPort()
      Returns the port.
      int hashCode()  
      (package private) static Host parse​(java.lang.CharSequence s)  
      (package private) static Host parse​(java.lang.CharSequence s, Tokenizer.Cursor cursor)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        private final java.lang.String name
      • lcName

        private final java.lang.String lcName
      • port

        private final int port
    • Constructor Detail

      • Host

        public Host​(java.lang.String name,
                    int port)
    • Method Detail

      • parse

        static Host parse​(java.lang.CharSequence s,
                          Tokenizer.Cursor cursor)
                   throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • parse

        static Host parse​(java.lang.CharSequence s)
                   throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • format

        static void format​(java.lang.StringBuilder buf,
                           NamedEndpoint endpoint)
      • format

        static void format​(java.lang.StringBuilder buf,
                           Host host)
      • format

        static java.lang.String format​(Host host)
      • create

        public static Host create​(java.lang.String s)
                           throws java.net.URISyntaxException
        Throws:
        java.net.URISyntaxException
      • getHostName

        public java.lang.String getHostName()
        Description copied from interface: NamedEndpoint
        Returns name (IP or DNS name).
        Specified by:
        getHostName in interface NamedEndpoint
        Returns:
        the host name (IP or DNS name)
      • getPort

        public int getPort()
        Description copied from interface: NamedEndpoint
        Returns the port.
        Specified by:
        getPort in interface NamedEndpoint
        Returns:
        the host port, or -1 if not set
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object