Class SocketUtil


  • public final class SocketUtil
    extends Object
    • Method Detail

      • isIPv6

        public static boolean isIPv6​(InetAddress ip)
        True if this InetAddress is a raw IPv6 in dotted quad notation.
      • hostname

        public static String hostname​(InetSocketAddress addr)
        Get the name or IP address, or * if this address is a wildcard IP.
      • format

        public static String format​(SocketAddress s,
                                    int defaultPort)
        Format an address string into host:port or *:port syntax.
      • format

        public static String format​(String hostname,
                                    int port)
        Format an address string into host:port or *:port syntax.
      • parse

        public static InetSocketAddress parse​(String desc,
                                              int defaultPort)
        Parse an address string such as host:port or *:port.
      • resolve

        public static InetSocketAddress resolve​(String desc,
                                                int defaultPort)
        Parse and resolve an address string, looking up the IP address.