public class InternetProtocolUtils extends Object
Constructor and Description |
---|
InternetProtocolUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
getLiteralIP(InetAddress address)
Returns
InetAddress.toString() without the hostname part and forward slash. |
static ProtocolFamily |
getProtocolFamily(InetAddress address) |
static boolean |
isIP4(InetSocketAddress address) |
static boolean |
isIP6(InetSocketAddress address) |
public static ProtocolFamily getProtocolFamily(InetAddress address)
StandardProtocolFamily.INET
for IPv4 address or StandardProtocolFamily.INET6
for IPv6 addressIllegalArgumentException
- if the address is neither IPv4 or IPv6public static boolean isIP4(InetSocketAddress address)
public static boolean isIP6(InetSocketAddress address)
public static String getLiteralIP(InetAddress address)
InetAddress.toString()
without the hostname part and forward slash.Copyright © 2016–2021. All rights reserved.