Class 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 an IpEndPoint object.
      IpEndPoint​(int port)
      Creates an IpEndPoint object with the localhost IP address (127.0.0.1) and the specified port.
      IpEndPoint​(long cPtr, boolean cMemoryOwn)
      For internal use only.
      IpEndPoint​(IpEndPoint arg0)
      Creates a copy of the specified IpEndPoint object
      IpEndPoint​(java.lang.String host)
      Creates an IpEndPoint object with the specified host.
      IpEndPoint​(java.lang.String host, int port)
      Creates an IpEndPoint object with the specified host and port.
      IpEndPoint​(java.lang.String host, int port, IpEndPoint.AddressType addressType)
      Creates an IpEndPoint object with the specified host, port and addressType.
    • 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 an IpEndPoint object which has the IP address that represents all IP addresses (usually only used in server scripts).
      static IpEndPoint getAny()
      Returns a wildcard IpEndPoint object.
      static IpEndPoint getBroadcast()
      Returns an IpEndPoint object which has an IP address that represents the broadcast address.
      static long getCPtr​(IpEndPoint obj)
      For internal use only.
      static IpEndPoint getLocal()
      Returns an IpEndPoint object with the localhost IP address (127.0.0.1).
      static IpEndPoint getNone()
      Returns a none IpEndPoint object.
      java.lang.String host()
      Gets the host (IP address).
      boolean isAll()
      Returns true if this is the All IpEndPoint.
      boolean isBroadcast()
      Returns true if this object has an IP address representing the broadcast address.
      boolean isLegal()
      Returns true if this object is in a legal state and ready for use by the API.
      boolean isStandard()
      Returns true 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 a String.
      IpEndPoint withPort​(int port)
      Creates a copy of this IpEndPoint object and sets the specified port number.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 object
        cMemoryOwn - indicates if this object is responsible for memory management of the CPP object
      • IpEndPoint

        public IpEndPoint()
        Creates an IpEndPoint object.
      • IpEndPoint

        public IpEndPoint​(int port)
        Creates an IpEndPoint object with the localhost IP address (127.0.0.1) and the specified port.
        Parameters:
        port - the port number
      • IpEndPoint

        public IpEndPoint​(IpEndPoint arg0)
        Creates a copy of the specified IpEndPoint object
        Parameters:
        arg0 - the IpEndPoint object to copy
      • IpEndPoint

        public IpEndPoint​(java.lang.String host,
                          int port,
                          IpEndPoint.AddressType addressType)
        Creates an IpEndPoint object with the specified host, port and addressType.
        Parameters:
        host - The hostname or IP address of the end point
        port - The port number of the end point
        addressType - The address type of the end point
      • IpEndPoint

        public IpEndPoint​(java.lang.String host,
                          int port)
        Creates an IpEndPoint object with the specified host and port.
        Parameters:
        host - The hostname or IP address of the end point
        port - The port number of the end point
      • IpEndPoint

        public IpEndPoint​(java.lang.String host)
        Creates an IpEndPoint object with the specified host.
        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 wildcard IpEndPoint 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 none IpEndPoint object. The returned object represents an uninitialised IpEndPoint.
        Returns:
        an IpEndPoint object
      • getLocal

        public static IpEndPoint getLocal()
        Returns an IpEndPoint 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 an IpEndPoint 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 an IpEndPoint 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
      • isLegal

        public boolean isLegal()
        Returns true 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()
        Returns true if this is the All IpEndPoint.
        Returns:
        true if this is the All IpEndPoint
        See Also:
        getAll()
      • isBroadcast

        public boolean isBroadcast()
        Returns true 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()
        Returns true 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 a String.

        e.g. localhost:8080

        Overrides:
        toString in class java.lang.Object
      • withPort

        public IpEndPoint withPort​(int port)
        Creates a copy of this IpEndPoint 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.