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 intDeprecated.final intimplements the java.lang.Comparable interfacefinal intDeprecated.UsecompareTo(org.jgroups.Address)insteadfinal booleanfinal byte[]Returns the additional_data.final InetAddressfinal intgetPort()final inthashCode()final booleanChecks whether this is an address that represents multiple destinations; e.g., a class D address in the Internet.voidvoidRead the state of the current object (including superclasses) from instream Note that the input stream must not be closedfinal voidsetAdditionalData(byte[] additional_data) Sets the additional_data.intsize()Returns serialized size of this addresstoString()voidvoidwriteTo(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:AddressChecks whether this is an address that represents multiple destinations; e.g., a class D address in the Internet.- Specified by:
isMulticastAddressin 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:
compareToin 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:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeTo
Description copied from interface:StreamableWrite the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed- Specified by:
writeToin interfaceStreamable- Throws:
IOException
-
readFrom
Description copied from interface:StreamableRead the state of the current object (including superclasses) from instream Note that the input stream must not be closed- Specified by:
readFromin interfaceStreamable- Throws:
IOException
-
size
public int size()Description copied from interface:AddressReturns serialized size of this address -
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
compareTo(org.jgroups.Address)instead