@Test public void shouldMatchIpv6Addresses() throws IPException { int i; byte[] unCompressedBytes; byte[] compressedBytes; String unCompressed[] = new String[]{"2001:DB8:0:0:8:800:200C:417A", "FF01:0:0:0:0:0:0:101", "0:0:0:0:0:0:0:1", "0:0:0:0:0:0:0:0", "0:0:0:0:0:0:13.1.68.3", "0:0:0:0:0:ffff:129.144.52.38"}; String compressed[] = new String[]{"2001:DB8::8:800:200C:417A", "FF01::101", "::1", "::", "::13.1.68.3", "::FFFF:129.144.52.38"}; for (i = 0; i < unCompressed.length; i++) { unCompressedBytes = new IPv6(unCompressed[i]).getBytes(); compressedBytes = new IPv6(compressed[i]).getBytes(); assertTrue(IPUtils.bytesEqual(unCompressedBytes, compressedBytes)); } }
public static boolean bytesEqual(byte[] a1, byte[] a2) { int i; if (a1.length != a2.length) { return false; } for (i = 0; i < a1.length; i++) { if (a1[i] != a2[i]) { return false; } } return true; }
IPUtils { public static boolean bytesEqual(byte[] a1, byte[] a2) { int i; if (a1.length != a2.length) { return false; } for (i = 0; i < a1.length; i++) { if (a1[i] != a2[i]) { return false; } } return true; } }
IPUtils { public static boolean bytesEqual(byte[] a1, byte[] a2) { int i; if (a1.length != a2.length) { return false; } for (i = 0; i < a1.length; i++) { if (a1[i] != a2[i]) { return false; } } return true; }  }
IPUtils { public static boolean bytesEqual(byte[] a1, byte[] a2) { int i; if (a1.length != a2.length) { return false; } for (i = 0; i < a1.length; i++) { if (a1[i] != a2[i]) { return false; } } return true; }  static boolean isValidIpv6String(String in); static final boolean isValidIpv4Subnet(String in); static boolean isValidIpv6Subnet(String in); static boolean isValidIpv4String(String in); static byte[] invBytes(byte[] mask); static byte[] opBytes(byte[] a1, byte[] a2, ByteStreamOperation bop); static byte[] rollMask(int mask, int addrSize); static boolean bytesEqual(byte[] a1, byte[] a2); }
IPUtils { public static boolean bytesEqual(byte[] a1, byte[] a2) { int i; if (a1.length != a2.length) { return false; } for (i = 0; i < a1.length; i++) { if (a1[i] != a2[i]) { return false; } } return true; }  static boolean isValidIpv6String(String in); static final boolean isValidIpv4Subnet(String in); static boolean isValidIpv6Subnet(String in); static boolean isValidIpv4String(String in); static byte[] invBytes(byte[] mask); static byte[] opBytes(byte[] a1, byte[] a2, ByteStreamOperation bop); static byte[] rollMask(int mask, int addrSize); static boolean bytesEqual(byte[] a1, byte[] a2);  }