org.javagroups.stack
Class IpAddress
java.lang.Object
|
+--org.javagroups.stack.IpAddress
- All Implemented Interfaces:
- Address, java.lang.Cloneable, java.lang.Comparable, java.io.Externalizable, java.io.Serializable
- 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
- See Also:
- Serialized Form
Field Summary |
protected static java.util.HashMap |
sAddrCache
|
Fields inherited from interface org.javagroups.Address |
GROUP |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
sAddrCache
protected static java.util.HashMap sAddrCache
IpAddress
public IpAddress()
IpAddress
public IpAddress(java.lang.String i,
int p)
IpAddress
public IpAddress(java.net.InetAddress i,
int p)
IpAddress
public IpAddress(int port)
getIpAddress
public java.net.InetAddress getIpAddress()
getPort
public int getPort()
isMulticastAddress
public boolean isMulticastAddress()
- Description copied from interface:
Address
- 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
- Following copied from interface:
org.javagroups.Address
- Returns:
- true if this is a multicast address, false if it is a unicast address
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(java.lang.Object o)
throws java.lang.ClassCastException
- implements the java.lang.Comparable interface
- Specified by:
compareTo
in interface java.lang.Comparable
- 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
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Specified by:
writeExternal
in interface java.io.Externalizable
readExternal
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Specified by:
readExternal
in interface java.io.Externalizable
getIpAddress
protected static java.net.InetAddress getIpAddress(byte[] addr)
Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.