java.lang.Object
net.i2p.apache.http.conn.util.InetAddressUtils
A collection of utilities relating to InetAddresses.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final charThe separator between IPv6 groups.private static final StringRegex source for a dotted-quad IPv4 address.private static final PatternCompiled pattern matching an IPv4-mapped IPv6 address.private static final PatternCompiled pattern matching an IPv4 address.private static final PatternCompiled pattern matching a compressed IPv6 address.private static final PatternCompiled pattern matching a fully written IPv6 address.private static final intMost colons an IPv6 address may contain, 7, i.e.Constructor Summary
ConstructorsModifierConstructorDescriptionprivateUtility class, not intended for instantiation.Method Summary
All MethodsModifier and TypeMethodDescriptionstatic booleanisIPv4Address(String input) Checks whether the parameter is a valid IPv4 address.static booleanisIPv4MappedIPv64Address(String input) Checks whether the parameter is a valid IPv4-mapped IPv6 address.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 address.static booleanisIPv6StdAddress(String input) Checks whether the parameter is a valid standard (non-compressed) IPv6 address.
Field Details
IPV4_BASIC_PATTERN_STRING
Regex source for a dotted-quad IPv4 address.- See Also:
IPV4_PATTERN
Compiled pattern matching an IPv4 address.IPV4_MAPPED_IPV6_PATTERN
Compiled pattern matching an IPv4-mapped IPv6 address.IPV6_STD_PATTERN
Compiled pattern matching a fully written IPv6 address.IPV6_HEX_COMPRESSED_PATTERN
Compiled pattern matching a compressed IPv6 address. Not totally rigorous, it allows for more than 7 hex fields in total.COLON_CHAR
private static final char COLON_CHARThe separator between IPv6 groups.- See Also:
MAX_COLON_COUNT
private static final int MAX_COLON_COUNTMost colons an IPv6 address may contain, 7, i.e. 8 fields.- See Also:
Constructor Details
InetAddressUtils
private InetAddressUtils()Utility class, not intended for instantiation.
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
Checks whether the parameter is a valid IPv4-mapped IPv6 address.- Parameters:
input- the address string to check for validity- Returns:
- true if the input parameter is a valid IPv4-mapped IPv6 address
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