return prefix4Factory.newInstance(addr.getHostAddress() + "/32");
}
- @Nonnull public final String stringForIpAddress(@Nonnull final A addr) {
- final A4 ipv4 = maybeIpv4Address(addr);
- if (ipv4 != null) {
- return ipv4AddressString(ipv4);
- }
- final A6 v6 = maybeIpv6Address(addr);
- checkArgument(v6 != null, "Address %s is neither IPv4 nor IPv6", addr);
- return ipv6AddressString(v6);
- }
-
- @Nonnull public final String stringForIpAddressNoZone(@Nonnull final ANZ addr) {
- final A4NZ v4 = maybeIpv4AddressNoZone(addr);
- if (v4 != null) {
- return ipv4AddressString(v4);
- }
- final A6NZ v6 = maybeIpv6AddressNoZone(addr);
- checkArgument(v6 != null, "Address %s is neither IPv4 nor IPv6", addr);
- return ipv6AddressString(v6);
- }
-
/**
* Create a Ipv4Prefix by combining the address with a mask. The address bytes are not masked.
*