org.jgroups.stack

Class IpAddress

Implemented Interfaces:
Address, Cloneable, Comparable, Externalizable

public class IpAddress
extends java.lang.Object
implements Address

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

Author:
Bela Ban

Field Summary

protected static Log
log
protected static HashMap
sAddrCache

Constructor Summary

IpAddress()
IpAddress(InetAddress i, int p)
IpAddress(String i, int p)
IpAddress(int port)

Method Summary

Object
clone()
int
compare(IpAddress other)
Establishes an order between 2 addresses.
int
compareTo(Object o)
implements the java.lang.Comparable interface
boolean
equals(Object obj)
byte[]
getAdditionalData()
Returns the additional_data.
InetAddress
getIpAddress()
protected static InetAddress
getIpAddress(byte[] addr)
int
getPort()
int
hashCode()
boolean
isMulticastAddress()
Checks whether this is an address that represents multiple destinations, e.g.
void
readExternal(ObjectInput in)
void
setAdditionalData(byte[] additional_data)
Sets the additional_data.
String
toString()
void
writeExternal(ObjectOutput out)

Field Details

log

protected static Log log


sAddrCache

protected static HashMap sAddrCache

Constructor Details

IpAddress

public IpAddress()


IpAddress

public IpAddress(InetAddress i,
                 int p)


IpAddress

public IpAddress(String i,
                 int p)


IpAddress

public IpAddress(int port)

Method Details

clone

public Object clone()
            throws CloneNotSupportedException


compare

public int compare(IpAddress other)
Establishes an order between 2 addresses. Assumes other contains non-null IpAddress. Excludes channel_name from comparison.

Returns:
0 for equality, value less than 0 if smaller, greater than 0 if greater.


compareTo

public int compareTo(Object o)
implements the java.lang.Comparable interface

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.

See Also:
java.lang.Comparable


equals

public boolean equals(Object obj)


getAdditionalData

public byte[] getAdditionalData()
Returns the additional_data.

Returns:
byte[]


getIpAddress

public InetAddress getIpAddress()


getIpAddress

protected static InetAddress getIpAddress(byte[] addr)


getPort

public int getPort()


hashCode

public int hashCode()


isMulticastAddress

public boolean isMulticastAddress()
Checks whether this is an address that represents multiple destinations, e.g. a class D address in the internet
Specified by:
isMulticastAddress in interface Address

Returns:
true if this is a multicast address, false if it is a unicast address


readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException


setAdditionalData

public void setAdditionalData(byte[] additional_data)
Sets the additional_data.

Parameters:
additional_data - The additional_data to set


toString

public String toString()


writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.