Top Description Fields Constructors Methods
org.apache.hc.core5.net

public Class InetAddressUtils

extends Object
Class Inheritance
Imports
java.net.InetAddress, .InetSocketAddress, .SocketAddress, .UnknownHostException, java.util.regex.Pattern, org.apache.hc.core5.util.Args

A collection of utilities relating to InetAddresses.
Since
4.0

Field Summary

Modifier and TypeField and Description
private static final char
public static final byte
IPV4

Represents the ipv4

private static final String
private static final Pattern
private static final Pattern
public static final byte
IPV6

Represents the ipv6.

private static final Pattern
private static final Pattern
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
formatAddress(final StringBuilder buffer, final SocketAddress socketAddress)

Formats SocketAddress as text.

public static String
getCanonicalLocalHostName()

Returns canonical name (fully qualified domain name) of the localhost.

pack-priv static boolean
public static boolean

Returns:

true if the input parameter is a valid IPv4 address
isIPv4Address
(final String
the address string to check for validity
input
)

Checks whether the parameter is a valid IPv4 address

public static boolean
public static boolean

Returns:

true if the input parameter is a valid standard or compressed IPv6 address
isIPv6Address
(final String
the address string to check for validity
input
)

Checks whether the parameter is a valid IPv6 address (including compressed).

public static boolean

Returns:

true if the input parameter is a valid compressed IPv6 address
isIPv6HexCompressedAddress
(final String
the address string to check for validity
input
)

Checks whether the parameter is a valid compressed IPv6 address

public static boolean

Returns:

true if the input parameter is a valid standard (non-compressed) IPv6 address
isIPv6StdAddress
(final String
the address string to check for validity
input
)

Checks whether the parameter is a valid standard (non-compressed) IPv6 address

public static boolean

Returns:

true if the input parameter is a valid URL-formatted bracketed IPv6 address
isIPv6URLBracketedAddress
(final String
the address string to check for validity
input
)

Checks whether the parameter is a valid URL formatted bracketed IPv6 address (including compressed).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COLON_CHARback to summary
private static final char COLON_CHAR
IPV4back to summary
public static final byte IPV4

Represents the ipv4

Since
5.1
IPV4_BASIC_PATTERN_STRINGback to summary
private static final String IPV4_BASIC_PATTERN_STRING
IPV4_MAPPED_IPV6_PATTERNback to summary
private static final Pattern IPV4_MAPPED_IPV6_PATTERN
IPV4_PATTERNback to summary
private static final Pattern IPV4_PATTERN
IPV6back to summary
public static final byte IPV6

Represents the ipv6.

Since
5.1
IPV6_HEX_COMPRESSED_PATTERNback to summary
private static final Pattern IPV6_HEX_COMPRESSED_PATTERN
IPV6_STD_PATTERNback to summary
private static final Pattern IPV6_STD_PATTERN
MAX_COLON_COUNTback to summary
private static final int MAX_COLON_COUNT

Constructor Detail

InetAddressUtilsback to summary
private InetAddressUtils()

Method Detail

formatAddressback to summary
public static void formatAddress(final StringBuilder buffer, final SocketAddress socketAddress)

Formats SocketAddress as text.

Since
5.0
getCanonicalLocalHostNameback to summary
public static String getCanonicalLocalHostName()

Returns canonical name (fully qualified domain name) of the localhost.

Since
5.0
hasValidIPv6ColonCountback to summary
pack-priv static boolean hasValidIPv6ColonCount(final String input)
isIPv4Addressback to summary
public static boolean isIPv4Address(final String input)

Checks whether the parameter is a valid IPv4 address

Parameters
input:String

the address string to check for validity

Returns:boolean

true if the input parameter is a valid IPv4 address

isIPv4MappedIPv64Addressback to summary
public static boolean isIPv4MappedIPv64Address(final String input)
isIPv6Addressback to summary
public static boolean isIPv6Address(final String input)

Checks whether the parameter is a valid IPv6 address (including compressed).

Parameters
input:String

the address string to check for validity

Returns:boolean

true if the input parameter is a valid standard or compressed IPv6 address

isIPv6HexCompressedAddressback to summary
public static boolean isIPv6HexCompressedAddress(final String input)

Checks whether the parameter is a valid compressed IPv6 address

Parameters
input:String

the address string to check for validity

Returns:boolean

true if the input parameter is a valid compressed IPv6 address

isIPv6StdAddressback to summary
public static boolean isIPv6StdAddress(final String input)

Checks whether the parameter is a valid standard (non-compressed) IPv6 address

Parameters
input:String

the address string to check for validity

Returns:boolean

true if the input parameter is a valid standard (non-compressed) IPv6 address

isIPv6URLBracketedAddressback to summary
public static boolean isIPv6URLBracketedAddress(final String input)

Checks whether the parameter is a valid URL formatted bracketed IPv6 address (including compressed). This matches only bracketed values e.g. [::1].

Parameters
input:String

the address string to check for validity

Returns:boolean

true if the input parameter is a valid URL-formatted bracketed IPv6 address