org.jgroups.stack

Class IpAddress

Implemented Interfaces:
Address, Cloneable, Comparable, Externalizable, Streamable

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

Constructor Summary

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

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()
int
getPort()
int
hashCode()
boolean
isMulticastAddress()
Checks whether this is an address that represents multiple destinations; e.g., a class D address in the Internet.
void
readExternal(ObjectInput in)
void
readFrom(DataInputStream in)
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
void
setAdditionalData(byte[] additional_data)
Sets the additional_data.
int
size()
Returns serialized size of this address
String
toString()
void
writeExternal(ObjectOutput out)
void
writeTo(DataOutputStream out)
Write the entire state of the current object (including superclasses) to outstream.

Field Details

log

protected static final Log log

Constructor Details

IpAddress

public IpAddress()

IpAddress

public IpAddress(InetAddress i,
                 int p)

IpAddress

public IpAddress(String i,
                 int p)

IpAddress

public IpAddress(int port)

IpAddress

public IpAddress(int port,
                 boolean set_default_host)

Method Details

clone

public Object clone()
            throws CloneNotSupportedException

compare

public final 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 final 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 final boolean equals(Object obj)

getAdditionalData

public final byte[] getAdditionalData()
Returns the additional_data.
Returns:
byte[]

getIpAddress

public final InetAddress getIpAddress()

getPort

public final int getPort()

hashCode

public final int hashCode()

isMulticastAddress

public final 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

readFrom

public void readFrom(DataInputStream in)
            throws IOException
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

setAdditionalData

public final void setAdditionalData(byte[] additional_data)
Sets the additional_data.
Parameters:
additional_data - The additional_data to set

size

public int size()
Returns serialized size of this address
Specified by:
size in interface Address

toString

public String toString()

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException

writeTo

public void writeTo(DataOutputStream out)
            throws IOException
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

Copyright B) 1998-2005 Bela Ban. All Rights Reserved.