Package com.facilita.fc.jni
Class IpEndPoint
- java.lang.Object
-
- com.facilita.fc.jni.IpEndPoint
-
public class IpEndPoint extends java.lang.ObjectThis 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 classIpEndPoint.AddressType
-
Constructor Summary
Constructors Constructor Description IpEndPoint()Creates anIpEndPointobject.IpEndPoint(int port)Creates anIpEndPointobject 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 specifiedIpEndPointobjectIpEndPoint(java.lang.String host)Creates anIpEndPointobject with the specifiedhost.IpEndPoint(java.lang.String host, int port)Creates anIpEndPointobject with the specifiedhostandport.IpEndPoint(java.lang.String host, int port, IpEndPoint.AddressType addressType)Creates anIpEndPointobject with the specifiedhost,portandaddressType.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IpEndPoint.AddressTypeaddressType()Gets the address type.voiddelete()static IpEndPointgetAll()Returns anIpEndPointobject which has the IP address that represents all IP addresses (usually only used in server scripts).static IpEndPointgetAny()Returns a wildcardIpEndPointobject.static IpEndPointgetBroadcast()Returns anIpEndPointobject which has an IP address that represents the broadcast address.static longgetCPtr(IpEndPoint obj)For internal use only.static IpEndPointgetLocal()Returns anIpEndPointobject with the localhost IP address (127.0.0.1).static IpEndPointgetNone()Returns a noneIpEndPointobject.java.lang.Stringhost()Gets the host (IP address).booleanisAll()Returnstrueif this is the All IpEndPoint.booleanisBroadcast()Returnstrueif this object has an IP address representing the broadcast address.booleanisLegal()Returnstrueif this object is in a legal state and ready for use by the API.booleanisStandard()Returnstrueif this object has a standard IP address and port.intport()Gets the port number.static IpEndPoint.AddressTypeswigToEnum(int swigValue)For internal use only.intswigValue()For internal use only.java.lang.StringtoString()Represents this object as aString.IpEndPointwithPort(int port)Creates a copy of thisIpEndPointobject 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 anIpEndPointobject.
-
IpEndPoint
public IpEndPoint(int port)
Creates anIpEndPointobject 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 specifiedIpEndPointobject- Parameters:
arg0- theIpEndPointobject to copy
-
IpEndPoint
public IpEndPoint(java.lang.String host, int port, IpEndPoint.AddressType addressType)Creates anIpEndPointobject with the specifiedhost,portandaddressType.- 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 anIpEndPointobject with the specifiedhostandport.- 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 anIpEndPointobject 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 wildcardIpEndPointobject. 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
IpEndPointobject
-
getNone
public static IpEndPoint getNone()
Returns a noneIpEndPointobject. The returned object represents an uninitialisedIpEndPoint.- Returns:
- an
IpEndPointobject
-
getLocal
public static IpEndPoint getLocal()
Returns anIpEndPointobject with the localhost IP address (127.0.0.1).e.g.
IpEndPoint local = IpEndPoint.getLocal().withPort(80); // "127.0.0.1:80"- Returns:
- an
IpEndPointobject with IP address 127.0.0.1
-
getAll
public static IpEndPoint getAll()
Returns anIpEndPointobject which has the IP address that represents all IP addresses (usually only used in server scripts).- Returns:
- an
IpEndPointobject
-
getBroadcast
public static IpEndPoint getBroadcast()
Returns anIpEndPointobject which has an IP address that represents the broadcast address.- Returns:
- an
IpEndPointobject
-
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()
Returnstrueif this object is in a legal state and ready for use by the API.- Returns:
trueif this object is in a legal state and ready for use by the API
-
isAll
public boolean isAll()
Returnstrueif this is the All IpEndPoint.- Returns:
trueif this is the All IpEndPoint- See Also:
getAll()
-
isBroadcast
public boolean isBroadcast()
Returnstrueif this object has an IP address representing the broadcast address.- Returns:
trueif this object has an IP address representing the broadcast address- See Also:
getBroadcast()
-
isStandard
public boolean isStandard()
Returnstrueif this object has a standard IP address and port.- Returns:
trueif 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:
toStringin classjava.lang.Object
-
withPort
public IpEndPoint withPort(int port)
Creates a copy of thisIpEndPointobject and sets the specified port number.- Parameters:
port- the new port number- Returns:
- a new
IpEndPointobject
-
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.
-
-