Class InetAddressUtil


  • public class InetAddressUtil
    extends Object
    InetAddress utility methods.
    Version:
    $id$
    Author:
    Matej Sekoranja
    • Constructor Detail

      • InetAddressUtil

        public InetAddressUtil()
    • Method Detail

      • intToIPv4Address

        public static InetAddress intToIPv4Address​(int addr)
        Convert an integer into an IPv4 INET address.
        Parameters:
        addr - integer representation of a given address.
        Returns:
        IPv4 INET address.
      • ipv4AddressToInt

        public static int ipv4AddressToInt​(InetAddress addr)
        Convert an IPv4 INET address to an integer.
        Parameters:
        addr - IPv4 INET address.
        Returns:
        integer representation of a given address.
        Throws:
        IllegalArgumentException - if the address is really an IPv6 address
      • getSocketAddressList

        public static InetSocketAddress[] getSocketAddressList​(String list,
                                                               int defaultPort)
        Parse space delimited addresss[:port] string and return array of InetSocketAddress.
        Parameters:
        list - space delimited addresss[:port] string.
        defaultPort - port take if not specified.
        Returns:
        array of InetSocketAddress.
      • getSocketAddressList

        public static InetSocketAddress[] getSocketAddressList​(String list,
                                                               int defaultPort,
                                                               InetSocketAddress[] appendList)
        Parse space delimited addresss[:port] string and return array of InetSocketAddress.
        Parameters:
        list - space delimited addresss[:port] string.
        defaultPort - port take if not specified.
        appendList - list to be appended.
        Returns:
        array of InetSocketAddress.