Class IpAddress

java.lang.Object
org.jgroups.stack.IpAddress
All Implemented Interfaces:
Comparable<Address>, Address, Constructable<IpAddress>, PhysicalAddress, SizeStreamable, Streamable

public class IpAddress extends Object implements PhysicalAddress, Constructable<IpAddress>
Network-dependent address (Internet). Generated by the bottommost layer of the protocol stack (UDP). Contains an InetAddress and port.
  • Field Details

    • ip_addr

      protected InetAddress ip_addr
    • port

      protected int port
  • Constructor Details

  • Method Details

    • create

      public Supplier<? extends IpAddress> create()
      Description copied from interface: Constructable
      Creates an instance of the class implementing this interface
      Specified by:
      create in interface Constructable<IpAddress>
    • setAddressToLocalHost

      protected void setAddressToLocalHost()
    • getIpAddress

      public InetAddress getIpAddress()
    • getPort

      public int getPort()
    • compareTo

      public int compareTo(Address o)
      implements the java.lang.Comparable interface
      Specified by:
      compareTo in interface 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:
      ClassCastException - - if the specified object's type prevents it from being compared to this Object.
      See Also:
    • equals

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

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

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

      public String printIpAddress()
      Specified by:
      printIpAddress in interface PhysicalAddress
    • printIpAddress2

      public String printIpAddress2()
    • printHostAddress

      public String printHostAddress()
    • writeTo

      public void writeTo(DataOutput out) throws 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:
      IOException
    • readFrom

      public void readFrom(DataInput in) throws 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:
      IOException
    • serializedSize

      public int serializedSize()
      Description copied from interface: SizeStreamable
      Returns the size (in bytes) of the marshalled object
      Specified by:
      serializedSize in interface SizeStreamable
    • copy

      public IpAddress copy()