Package org.apache.hc.core5.net
Class InetAddressUtils
java.lang.Object
org.apache.hc.core5.net.InetAddressUtils
A collection of utilities relating to InetAddresses.
- Since:
- 4.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidformatAddress(StringBuilder buffer, SocketAddress socketAddress) FormatsSocketAddressas text.static StringReturns canonical name (fully qualified domain name) of the localhost.static booleanisIPv4Address(String input) Checks whether the parameter is a valid IPv4 addressstatic booleanisIPv4MappedIPv64Address(String input) static booleanisIPv6Address(String input) Checks whether the parameter is a valid IPv6 address (including compressed).static booleanisIPv6HexCompressedAddress(String input) Checks whether the parameter is a valid compressed IPv6 addressstatic booleanisIPv6StdAddress(String input) Checks whether the parameter is a valid standard (non-compressed) IPv6 addressstatic booleanisIPv6URLBracketedAddress(String input) Checks whether the parameter is a valid URL formatted bracketed IPv6 address (including compressed).
-
Field Details
-
IPV4
public static final byte IPV4Represents the ipv4- Since:
- 5.1
- See Also:
-
IPV6
public static final byte IPV6Represents the ipv6.- Since:
- 5.1
- See Also:
-
-
Method Details
-
isIPv4Address
Checks whether the parameter is a valid IPv4 address- Parameters:
input- the address string to check for validity- Returns:
- true if the input parameter is a valid IPv4 address
-
isIPv4MappedIPv64Address
-
isIPv6StdAddress
Checks whether the parameter is a valid standard (non-compressed) IPv6 address- Parameters:
input- the address string to check for validity- Returns:
- true if the input parameter is a valid standard (non-compressed) IPv6 address
-
isIPv6HexCompressedAddress
Checks whether the parameter is a valid compressed IPv6 address- Parameters:
input- the address string to check for validity- Returns:
- true if the input parameter is a valid compressed IPv6 address
-
isIPv6Address
Checks whether the parameter is a valid IPv6 address (including compressed).- Parameters:
input- the address string to check for validity- Returns:
- true if the input parameter is a valid standard or compressed IPv6 address
-
isIPv6URLBracketedAddress
Checks whether the parameter is a valid URL formatted bracketed IPv6 address (including compressed). This matches only bracketed values e.g.[::1].- Parameters:
input- the address string to check for validity- Returns:
- true if the input parameter is a valid URL-formatted bracketed IPv6 address
-
formatAddress
FormatsSocketAddressas text.- Since:
- 5.0
-
getCanonicalLocalHostName
Returns canonical name (fully qualified domain name) of the localhost.- Since:
- 5.0
-