Class IpAddress

    • Field Detail

      • ip_addr

        protected java.net.InetAddress ip_addr
      • port

        protected int port
    • Constructor Detail

      • IpAddress

        public IpAddress()
      • IpAddress

        public IpAddress​(java.lang.String addr_port)
                  throws java.lang.Exception
        e.g. 192.168.1.5:7800
        Throws:
        java.lang.Exception
      • IpAddress

        public IpAddress​(java.lang.String i,
                         int p)
                  throws java.net.UnknownHostException
        Throws:
        java.net.UnknownHostException
      • IpAddress

        public IpAddress​(java.net.InetAddress i,
                         int p)
      • IpAddress

        public IpAddress​(int port)
      • IpAddress

        public IpAddress​(int port,
                         boolean set_default_host)
      • IpAddress

        public IpAddress​(java.net.InetSocketAddress sock_addr)
    • Method Detail

      • setAddressToLocalHost

        protected void setAddressToLocalHost()
      • getIpAddress

        public java.net.InetAddress getIpAddress()
      • getPort

        public int getPort()
      • compareTo

        public int compareTo​(Address o)
        implements the java.lang.Comparable interface
        Specified by:
        compareTo in interface java.lang.Comparable<Address>
        Parameters:
        o - - the Object to be compared
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        java.lang.ClassCastException - - if the specified object's type prevents it from being compared to this Object.
        See Also:
        Comparable
      • equals

        public boolean equals​(java.lang.Object obj)
        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
      • printIpAddress2

        public java.lang.String printIpAddress2()
      • writeTo

        public void writeTo​(java.io.DataOutput out)
                     throws java.io.IOException
        Description copied from interface: Streamable
        Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed
        Specified by:
        writeTo in interface Streamable
        Throws:
        java.io.IOException
      • readFrom

        public void readFrom​(java.io.DataInput in)
                      throws java.io.IOException
        Description copied from interface: Streamable
        Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
        Specified by:
        readFrom in interface Streamable
        Throws:
        java.io.IOException