@Test public void testApplyMaskOnIpv6Address_PrefixLengthOutOfRange () { Ipv6Address prefix = new Ipv6Address(IPV6_HOST_ADDRESS); thrown.expect(IllegalArgumentException.class); NetUtils.applyMaskOnIpv6Address(prefix, 130); }
public static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength) { if (ipv6Address == null) { return null; } com.googlecode.ipv6.IPv6Address ip = com.googlecode.ipv6.IPv6Address.fromString(ipv6Address.getValue()); IPv6NetworkMask mask = IPv6NetworkMask.fromPrefixLength(ipv6MaskLength); ip = ip.maskWithNetworkMask(mask); return new Ipv6Address(ip.toString()); }
NetUtils { public static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength) { if (ipv6Address == null) { return null; } com.googlecode.ipv6.IPv6Address ip = com.googlecode.ipv6.IPv6Address.fromString(ipv6Address.getValue()); IPv6NetworkMask mask = IPv6NetworkMask.fromPrefixLength(ipv6MaskLength); ip = ip.maskWithNetworkMask(mask); return new Ipv6Address(ip.toString()); } }
NetUtils { public static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength) { if (ipv6Address == null) { return null; } com.googlecode.ipv6.IPv6Address ip = com.googlecode.ipv6.IPv6Address.fromString(ipv6Address.getValue()); IPv6NetworkMask mask = IPv6NetworkMask.fromPrefixLength(ipv6MaskLength); ip = ip.maskWithNetworkMask(mask); return new Ipv6Address(ip.toString()); }  }
NetUtils { public static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength) { if (ipv6Address == null) { return null; } com.googlecode.ipv6.IPv6Address ip = com.googlecode.ipv6.IPv6Address.fromString(ipv6Address.getValue()); IPv6NetworkMask mask = IPv6NetworkMask.fromPrefixLength(ipv6MaskLength); ip = ip.maskWithNetworkMask(mask); return new Ipv6Address(ip.toString()); }  static int getMaskFromPrefix(@Nullable String prefix); static @Nonnull String getIpAddrFromPrefix(@Nullable String prefix); static @Nullable Ipv6Address applyMaskOnIpv6Prefix(@Nullable Ipv6Prefix ipv6Prefix, int ipv6MaskLength); static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength); static boolean samePrefix(@Nullable IpPrefix prefix1, @Nullable IpPrefix prefix2); static boolean isInRange(@Nullable IpPrefix prefix, @Nullable String ipAddress); }
NetUtils { public static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength) { if (ipv6Address == null) { return null; } com.googlecode.ipv6.IPv6Address ip = com.googlecode.ipv6.IPv6Address.fromString(ipv6Address.getValue()); IPv6NetworkMask mask = IPv6NetworkMask.fromPrefixLength(ipv6MaskLength); ip = ip.maskWithNetworkMask(mask); return new Ipv6Address(ip.toString()); }  static int getMaskFromPrefix(@Nullable String prefix); static @Nonnull String getIpAddrFromPrefix(@Nullable String prefix); static @Nullable Ipv6Address applyMaskOnIpv6Prefix(@Nullable Ipv6Prefix ipv6Prefix, int ipv6MaskLength); static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength); static boolean samePrefix(@Nullable IpPrefix prefix1, @Nullable IpPrefix prefix2); static boolean isInRange(@Nullable IpPrefix prefix, @Nullable String ipAddress);  }