Package org.jgroups.stack
Class IpAddress
java.lang.Object
org.jgroups.stack.IpAddress
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,Comparable
,Address
,Streamable
Network-dependent address (Internet). Generated by the bottommost layer of the protocol
stack (UDP). Contains an InetAddress and port.
- Author:
- Bela Ban
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIpAddress
(int port) IpAddress
(int port, boolean set_default_host) IpAddress
(InetAddress i, int p) IpAddress
(InetSocketAddress sock_addr) -
Method Summary
Modifier and TypeMethodDescriptionclone()
final int
Deprecated.final int
implements the java.lang.Comparable interfacefinal int
Deprecated.UsecompareTo(org.jgroups.Address)
insteadfinal boolean
final byte[]
Returns the additional_data.final InetAddress
final int
getPort()
final int
hashCode()
final boolean
Checks whether this is an address that represents multiple destinations; e.g., a class D address in the Internet.void
void
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedfinal void
setAdditionalData
(byte[] additional_data) Sets the additional_data.int
size()
Returns serialized size of this addresstoString()
void
void
writeTo
(DataOutputStream out) Write the entire state of the current object (including superclasses) to outstream.
-
Field Details
-
log
protected static final org.apache.commons.logging.Log log
-
-
Constructor Details
-
IpAddress
public IpAddress() -
IpAddress
- Throws:
UnknownHostException
-
IpAddress
-
IpAddress
public IpAddress(int port) -
IpAddress
public IpAddress(int port, boolean set_default_host) -
IpAddress
-
-
Method Details
-
getIpAddress
-
getPort
public final int getPort() -
isMulticastAddress
public final 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 interfaceAddress
- Returns:
- true if this is a multicast address, false if it is a unicast address
-
getAdditionalData
public final byte[] getAdditionalData()Returns the additional_data.- Returns:
- byte[]
-
setAdditionalData
public final void setAdditionalData(byte[] additional_data) Sets the additional_data.- Parameters:
additional_data
- The additional_data to set
-
compare
Deprecated.UsecompareTo(org.jgroups.Address)
insteadEstablishes 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
implements the java.lang.Comparable interface- Specified by:
compareTo
in interfaceComparable
- 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:
-
compareToUnique
Deprecated.UsecompareTo(org.jgroups.Address)
insteadThis method compares both addresses' dotted-decimal notation in string format if the hashcode and ports are identical. Ca 30% slower thancompareTo(Object)
if used excessively.- Parameters:
o
-- Returns:
-
equals
-
hashCode
public final int hashCode() -
toString
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeTo
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 interfaceStreamable
- Throws:
IOException
-
readFrom
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 interfaceStreamable
- Throws:
IOException
-
size
public int size()Description copied from interface:Address
Returns serialized size of this address -
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
compareTo(org.jgroups.Address)
instead