Class IpAddress
java.lang.Object
org.jgroups.stack.IpAddress
- All Implemented Interfaces:
Comparable<Address>, Address, Constructable<IpAddress>, PhysicalAddress, SizeStreamable, Streamable
Network-dependent address (Internet). Generated by the bottommost layer of the protocol
stack (UDP). Contains an InetAddress and port.
- Author:
- Bela Ban
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIpAddress(int p) e.g.IpAddress(InetAddress i, int p) IpAddress(InetSocketAddress sock_addr) -
Method Summary
Modifier and TypeMethodDescriptionintimplements the java.lang.Comparable interfacecopy()create()Creates an instance of the class implementing this interfacebooleanstatic InetAddressstatic InetAddressintgetPort()inthashCode()voidRead the state of the current object (including superclasses) from instream Note that the input stream must not be closedintReturns the size (in bytes) of the marshalled objectprotected voidsetAddress(InetAddress i, int p) toString()voidwriteTo(DataOutput out) Write the entire state of the current object (including superclasses) to outstream.Methods inherited from interface Address
isMulticast, isSiteAddress, isSiteMasterMethods inherited from interface PhysicalAddress
getSocketAddress
-
Field Details
-
ip_addr
-
port
protected int port
-
-
Constructor Details
-
IpAddress
public IpAddress() -
IpAddress
-
IpAddress
- Throws:
UnknownHostException
-
IpAddress
-
IpAddress
public IpAddress(int p) -
IpAddress
-
-
Method Details
-
create
Description copied from interface:ConstructableCreates an instance of the class implementing this interface- Specified by:
createin interfaceConstructable<IpAddress>- Returns:
- Supplier
-
getByName
- Throws:
UnknownHostException
-
getLocalHost
-
getIpAddress
- Specified by:
getIpAddressin interfacePhysicalAddress
-
getPort
public int getPort()- Specified by:
getPortin interfacePhysicalAddress
-
compareTo
implements the java.lang.Comparable interface- Specified by:
compareToin interfaceComparable<Address>- 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:
-
equals
-
hashCode
-
toString
-
printIpAddress
- Specified by:
printIpAddressin interfacePhysicalAddress
-
printIpAddress2
-
printHostAddress
-
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
-
serializedSize
public int serializedSize()Description copied from interface:SizeStreamableReturns the size (in bytes) of the marshalled object- Specified by:
serializedSizein interfaceSizeStreamable
-
copy
-
setAddress
-