Package 

Class TransportAddress

  • All Implemented Interfaces:
    java.io.Serializable

    
    public class TransportAddress
    extends InetSocketAddress
                        

    The Address class is used to define destinations to outgoing Stun Packets.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Transport getTransport() The transport that this transport address is suggesting.
      Array<byte> getAddressBytes() Returns the raw IP address of this Address object.
      String toString() Constructs a string representation of this InetSocketAddress.
      String getHostAddress() Returns the host address.
      boolean equals(TransportAddress transportAddress) Determines whether this TransportAddress is value equal to a specific TransportAddress.
      boolean equalsTransportAddress(Object obj) Compares this object against the specified object.
      boolean isIPv6() Returns true if this is an IPv6 address and false otherwise.
      boolean canReach(TransportAddress dst) Determines whether this TransportAddress is theoretically capable of communicating with dst.
      • Methods inherited from class java.net.InetSocketAddress

        createUnresolved, equals, getAddress, getHostName, getHostString, getPort, hashCode, isUnresolved
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TransportAddress

        TransportAddress(String hostname, int port, Transport transport)
        Creates an address instance address from an IP address and a port number.
        Parameters:
        hostname - The IP address
        port - The port number
        transport - The transport that this address would be bound to.
      • TransportAddress

        TransportAddress(Array<byte> ipAddress, int port, Transport transport)
        Creates an address instance address from a byte array containing an IP address and a port number.
        Parameters:
        ipAddress - The IP address
        port - The port number
        transport - The Transport to use with this address.
      • TransportAddress

        TransportAddress(InetSocketAddress address, Transport transport)
        Creates an address instance from an InetSocketAddress.
        Parameters:
        address - the address and port.
        transport - the transport to use with this address.
      • TransportAddress

        TransportAddress(InetAddress address, int port, Transport transport)
        Creates an address instance from a host name and a port number.
        Parameters:
        address - the address itself
        port - the port number
        transport - the transport to use with this address.
    • Method Detail

      • getAddressBytes

         Array<byte> getAddressBytes()

        Returns the raw IP address of this Address object. The result is in network byte order: the highest order byte of the address is in getAddress()[0].

      • toString

         String toString()

        Constructs a string representation of this InetSocketAddress. This String is constructed by calling toString() on the InetAddress and concatenating the port number (with a colon). If the address is unresolved then the part before the colon will only contain the host name.

      • equals

         boolean equals(TransportAddress transportAddress)

        Determines whether this TransportAddress is value equal to a specific TransportAddress.

        Parameters:
        transportAddress - the TransportAddress to test for value equality with this TransportAddress
      • equalsTransportAddress

         boolean equalsTransportAddress(Object obj)

        Compares this object against the specified object. The result is true if and only if the argument is not null and it represents the same address.

        Two instances of TransportAddress represent the same address if both the InetAddresses (or hostnames if it is unresolved), port numbers, and Transports are equal. If both addresses are unresolved, then the hostname, the port and the Transport are compared.

        Parameters:
        obj - the object to compare against.
      • isIPv6

         boolean isIPv6()

        Returns true if this is an IPv6 address and false otherwise.

      • canReach

         boolean canReach(TransportAddress dst)

        Determines whether this TransportAddress is theoretically capable of communicating with dst. An address is certain not to be able to communicate with another if they do not have the same Transport or family.

        Parameters:
        dst - the TransportAddress that we'd like to check for reachability from this one.