Package com.facilita.fc.jni
Class IpEndPoint
- java.lang.Object
-
- com.facilita.fc.jni.IpEndPoint
-
public class IpEndPoint extends java.lang.Object
This class encapsulates IP address and port. Static methods are provided to create objects with commonly used patterns and address families.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IpEndPoint.AddressType
-
Constructor Summary
Constructors Constructor Description IpEndPoint()
Creates anIpEndPoint
object.IpEndPoint(int port)
Creates anIpEndPoint
object with the localhost IP address (127.0.0.1) and the specifiedport
.IpEndPoint(long cPtr, boolean cMemoryOwn)
For internal use only.IpEndPoint(IpEndPoint arg0)
Creates a copy of the specifiedIpEndPoint
objectIpEndPoint(java.lang.String host)
Creates anIpEndPoint
object with the specifiedhost
.IpEndPoint(java.lang.String host, int port)
Creates anIpEndPoint
object with the specifiedhost
andport
.IpEndPoint(java.lang.String host, int port, IpEndPoint.AddressType addressType)
Creates anIpEndPoint
object with the specifiedhost
,port
andaddressType
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IpEndPoint.AddressType
addressType()
Gets the address type.void
delete()
static IpEndPoint
getAll()
Returns anIpEndPoint
object which has the IP address that represents all IP addresses (usually only used in server scripts).static IpEndPoint
getAny()
Returns a wildcardIpEndPoint
object.static IpEndPoint
getBroadcast()
Returns anIpEndPoint
object which has an IP address that represents the broadcast address.static long
getCPtr(IpEndPoint obj)
For internal use only.static IpEndPoint
getLocal()
Returns anIpEndPoint
object with the localhost IP address (127.0.0.1).static IpEndPoint
getNone()
Returns a noneIpEndPoint
object.java.lang.String
host()
Gets the host (IP address).boolean
isAll()
Returnstrue
if this is the All IpEndPoint.boolean
isBroadcast()
Returnstrue
if this object has an IP address representing the broadcast address.boolean
isLegal()
Returnstrue
if this object is in a legal state and ready for use by the API.boolean
isStandard()
Returnstrue
if this object has a standard IP address and port.int
port()
Gets the port number.static IpEndPoint.AddressType
swigToEnum(int swigValue)
For internal use only.int
swigValue()
For internal use only.java.lang.String
toString()
Represents this object as aString
.IpEndPoint
withPort(int port)
Creates a copy of thisIpEndPoint
object and sets the specified port number.
-
-
-
Constructor Detail
-
IpEndPoint
public IpEndPoint(long cPtr, boolean cMemoryOwn)
For internal use only. Of no interest to the user.- Parameters:
cPtr
- pointer to the CPP wrapped objectcMemoryOwn
- indicates if this object is responsible for memory management of the CPP object
-
IpEndPoint
public IpEndPoint()
Creates anIpEndPoint
object.
-
IpEndPoint
public IpEndPoint(int port)
Creates anIpEndPoint
object with the localhost IP address (127.0.0.1) and the specifiedport
.- Parameters:
port
- the port number
-
IpEndPoint
public IpEndPoint(IpEndPoint arg0)
Creates a copy of the specifiedIpEndPoint
object- Parameters:
arg0
- theIpEndPoint
object to copy
-
IpEndPoint
public IpEndPoint(java.lang.String host, int port, IpEndPoint.AddressType addressType)
Creates anIpEndPoint
object with the specifiedhost
,port
andaddressType
.- Parameters:
host
- The hostname or IP address of the end pointport
- The port number of the end pointaddressType
- The address type of the end point
-
IpEndPoint
public IpEndPoint(java.lang.String host, int port)
Creates anIpEndPoint
object with the specifiedhost
andport
.- Parameters:
host
- The hostname or IP address of the end pointport
- The port number of the end point
-
IpEndPoint
public IpEndPoint(java.lang.String host)
Creates anIpEndPoint
object with the specifiedhost
.- Parameters:
host
- The hostname or IP address of the end point
-
-
Method Detail
-
getCPtr
public static long getCPtr(IpEndPoint obj)
For internal use only. Of no interest to the user.- Parameters:
obj
- a reference to an object of this class- Returns:
- a long containing the address of the CPP wrapped object
-
delete
public void delete()
-
getAny
public static IpEndPoint getAny()
Returns a wildcardIpEndPoint
object. The returned object represents an IP address and port where the actual values used by the low level communication layers will be determined by the Operating System.- Returns:
- an
IpEndPoint
object
-
getNone
public static IpEndPoint getNone()
Returns a noneIpEndPoint
object. The returned object represents an uninitialisedIpEndPoint
.- Returns:
- an
IpEndPoint
object
-
getLocal
public static IpEndPoint getLocal()
Returns anIpEndPoint
object with the localhost IP address (127.0.0.1).e.g.
IpEndPoint local = IpEndPoint.getLocal().withPort(80); // "127.0.0.1:80"
- Returns:
- an
IpEndPoint
object with IP address 127.0.0.1
-
getAll
public static IpEndPoint getAll()
Returns anIpEndPoint
object which has the IP address that represents all IP addresses (usually only used in server scripts).- Returns:
- an
IpEndPoint
object
-
getBroadcast
public static IpEndPoint getBroadcast()
Returns anIpEndPoint
object which has an IP address that represents the broadcast address.- Returns:
- an
IpEndPoint
object
-
host
public java.lang.String host()
Gets the host (IP address).- Returns:
- the IP address
-
port
public int port()
Gets the port number.- Returns:
- the port number
-
addressType
public IpEndPoint.AddressType addressType()
Gets the address type.- Returns:
- the address type
-
isLegal
public boolean isLegal()
Returnstrue
if this object is in a legal state and ready for use by the API.- Returns:
true
if this object is in a legal state and ready for use by the API
-
isAll
public boolean isAll()
Returnstrue
if this is the All IpEndPoint.- Returns:
true
if this is the All IpEndPoint- See Also:
getAll()
-
isBroadcast
public boolean isBroadcast()
Returnstrue
if this object has an IP address representing the broadcast address.- Returns:
true
if this object has an IP address representing the broadcast address- See Also:
getBroadcast()
-
isStandard
public boolean isStandard()
Returnstrue
if this object has a standard IP address and port.- Returns:
true
if this object has a standard IP address and port- See Also:
getBroadcast()
-
toString
public java.lang.String toString()
Represents this object as aString
.e.g.
localhost:8080
- Overrides:
toString
in classjava.lang.Object
-
withPort
public IpEndPoint withPort(int port)
Creates a copy of thisIpEndPoint
object and sets the specified port number.- Parameters:
port
- the new port number- Returns:
- a new
IpEndPoint
object
-
swigValue
public final int swigValue()
For internal use only.- Returns:
- Internal use only.
-
swigToEnum
public static IpEndPoint.AddressType swigToEnum(int swigValue)
For internal use only.- Parameters:
swigValue
- internal use only- Returns:
- Internal use only.
-
-