@Test public void testIsCanonical() { Assert.assertTrue(Cidr.isCanonical("10.0.0.0/8")); Assert.assertTrue(Cidr.isCanonical("10.0.0.0/16")); Assert.assertTrue(Cidr.isCanonical(Cidr._172_16.toString())); Assert.assertFalse(Cidr.isCanonical("10.0.0.1/8")); Assert.assertFalse(Cidr.isCanonical("/0")); Assert.assertFalse(Cidr.isCanonical("10.0.0.0/33")); }
public static boolean isCanonical(String cidr) { try { return cidr.equals(new Cidr(cidr).toString()); } catch (Throwable e) { Exceptions.propagateIfFatal(e); return false; } }
Cidr implements Serializable { public static boolean isCanonical(String cidr) { try { return cidr.equals(new Cidr(cidr).toString()); } catch (Throwable e) { Exceptions.propagateIfFatal(e); return false; } } }
Cidr implements Serializable { public static boolean isCanonical(String cidr) { try { return cidr.equals(new Cidr(cidr).toString()); } catch (Throwable e) { Exceptions.propagateIfFatal(e); return false; } } Cidr(String cidr);  Cidr(int ...unsignedBytes);  Cidr(int[] subnetBytes, int length); }
Cidr implements Serializable { public static boolean isCanonical(String cidr) { try { return cidr.equals(new Cidr(cidr).toString()); } catch (Throwable e) { Exceptions.propagateIfFatal(e); return false; } } Cidr(String cidr);  Cidr(int ...unsignedBytes);  Cidr(int[] subnetBytes, int length); static boolean isCanonical(String cidr); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); int[] getBytes(); int getLength(); Cidr subnet(int ...extraUnsignedBytes); InetAddress netmask(); InetAddress addressAtOffset(int offset); int commonPrefixLength(Cidr other); Cidr commonPrefix(Cidr other); BitList asBitList(); boolean contains(Cidr target); @Deprecated static InetAddress getInetAddressWithFixedName(byte[] ip); }
Cidr implements Serializable { public static boolean isCanonical(String cidr) { try { return cidr.equals(new Cidr(cidr).toString()); } catch (Throwable e) { Exceptions.propagateIfFatal(e); return false; } } Cidr(String cidr);  Cidr(int ...unsignedBytes);  Cidr(int[] subnetBytes, int length); static boolean isCanonical(String cidr); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); int[] getBytes(); int getLength(); Cidr subnet(int ...extraUnsignedBytes); InetAddress netmask(); InetAddress addressAtOffset(int offset); int commonPrefixLength(Cidr other); Cidr commonPrefix(Cidr other); BitList asBitList(); boolean contains(Cidr target); @Deprecated static InetAddress getInetAddressWithFixedName(byte[] ip); static final Cidr UNIVERSAL; static final Cidr _10; static final Cidr _172_16; static final Cidr _192_168; static final Cidr CLASS_A; static final Cidr CLASS_B; static final Cidr CLASS_C; static final List<Cidr> PRIVATE_NETWORKS_RFC_1918; static final Cidr _169_254; static final Cidr LINK_LOCAL; static final Cidr _127; static final Cidr LOOPBACK; static final List<Cidr> NON_PUBLIC_CIDRS; }