Class IpAddress

    • Constructor Summary

      Constructors 
      Constructor Description
      IpAddress()  
      IpAddress​(int port)  
      IpAddress​(int port, boolean set_default_host)  
      IpAddress​(java.lang.String addr_port)
      e.g.
      IpAddress​(java.lang.String i, int p)  
      IpAddress​(java.net.InetAddress i, int p)  
      IpAddress​(java.net.InetSocketAddress sock_addr)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Address o)
      implements the java.lang.Comparable interface
      IpAddress copy()  
      java.util.function.Supplier<? extends IpAddress> create()
      Creates an instance of the class implementing this interface
      boolean equals​(java.lang.Object obj)  
      java.net.InetAddress getIpAddress()  
      int getPort()  
      int hashCode()  
      java.lang.String printIpAddress()  
      java.lang.String printIpAddress2()  
      void readFrom​(java.io.DataInput in)
      Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
      int serializedSize()
      Returns the size (in bytes) of the marshalled object
      protected void setAddressToLocalHost()  
      java.lang.String toString()  
      void writeTo​(java.io.DataOutput out)
      Write the entire state of the current object (including superclasses) to outstream.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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