org.jgroups.stack
Class IpAddress

java.lang.Object
  extended by org.jgroups.stack.IpAddress
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Comparable<Address>, Address, PhysicalAddress, Streamable

public class IpAddress
extends java.lang.Object
implements PhysicalAddress

Network-dependent address (Internet). Generated by the bottommost layer of the protocol stack (UDP). Contains an InetAddress and port.

Author:
Bela Ban
See Also:
Serialized Form

Field Summary
protected static Log log
           
protected  int size
           
 
Fields inherited from interface org.jgroups.Address
IP_ADDR, NULL, SITE_MASTER, SITE_UUID, UUID_ADDR
 
Constructor Summary
IpAddress()
           
IpAddress(java.net.InetAddress i, int p)
           
IpAddress(java.net.InetSocketAddress sock_addr)
           
IpAddress(int port)
           
IpAddress(int port, boolean set_default_host)
           
IpAddress(java.lang.String i, int p)
           
 
Method Summary
 int compareTo(Address o)
          implements the java.lang.Comparable interface
 IpAddress copy()
           
 boolean equals(java.lang.Object obj)
           
 java.net.InetAddress getIpAddress()
           
 int getPort()
           
 int hashCode()
           
 void readExternal(java.io.ObjectInput in)
           
 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 size()
          Returns serialized size of this address
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 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

log

protected static final Log log

size

protected int size
Constructor Detail

IpAddress

public IpAddress()

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

getIpAddress

public final java.net.InetAddress getIpAddress()

getPort

public final int getPort()

compareTo

public final 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 final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

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

toString

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

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

writeTo

public void writeTo(java.io.DataOutput out)
             throws java.lang.Exception
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.lang.Exception

readFrom

public void readFrom(java.io.DataInput in)
              throws java.lang.Exception
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.lang.Exception

size

public int size()
Description copied from interface: Address
Returns serialized size of this address

Specified by:
size in interface Address

copy

public IpAddress copy()


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.