@Test public void isScopeStringTest() { for (int i = 0; i < 256; i++) { boolean isScope = AclUtils.isScope(i + ""); Assert.assertTrue(isScope); } boolean isScope = AclUtils.isScope("-1"); Assert.assertFalse(isScope); isScope = AclUtils.isScope("256"); Assert.assertFalse(isScope); }
public static boolean isScope(String netaddress, int index) { if (isColon(netaddress)) { netaddress = expandIP(netaddress, 8); String[] strArray = StringUtils.split(netaddress, ":"); return isIPv6Scope(strArray, index); } String[] strArray = StringUtils.split(netaddress, "."); if (strArray.length != 4) { return false; } return isScope(strArray, index); }
AclUtils { public static boolean isScope(String netaddress, int index) { if (isColon(netaddress)) { netaddress = expandIP(netaddress, 8); String[] strArray = StringUtils.split(netaddress, ":"); return isIPv6Scope(strArray, index); } String[] strArray = StringUtils.split(netaddress, "."); if (strArray.length != 4) { return false; } return isScope(strArray, index); } }
AclUtils { public static boolean isScope(String netaddress, int index) { if (isColon(netaddress)) { netaddress = expandIP(netaddress, 8); String[] strArray = StringUtils.split(netaddress, ":"); return isIPv6Scope(strArray, index); } String[] strArray = StringUtils.split(netaddress, "."); if (strArray.length != 4) { return false; } return isScope(strArray, index); }  }
AclUtils { public static boolean isScope(String netaddress, int index) { if (isColon(netaddress)) { netaddress = expandIP(netaddress, 8); String[] strArray = StringUtils.split(netaddress, ":"); return isIPv6Scope(strArray, index); } String[] strArray = StringUtils.split(netaddress, "."); if (strArray.length != 4) { return false; } return isScope(strArray, index); }  static byte[] combineRequestContent(RemotingCommand request, SortedMap<String, String> fieldsMap); static byte[] combineBytes(byte[] b1, byte[] b2); static String calSignature(byte[] data, String secretKey); static void IPv6AddressCheck(String netaddress); static String v6ipProcess(String netaddress, String[] strArray, int index); static void verify(String netaddress, int index); static String[] getAddreeStrArray(String netaddress, String partialAddress); static boolean isScope(String netaddress, int index); static boolean isScope(String[] num, int index); static boolean isColon(String netaddress); static boolean isScope(String num); static boolean isScope(int num); static boolean isAsterisk(String asterisk); static boolean isComma(String colon); static boolean isMinus(String minus); static boolean isIPv6Scope(String[] num, int index); static boolean isIPv6Scope(int num); static String expandIP(String netaddress, int part); static T getYamlDataObject(String path, Class<T> clazz); static boolean writeDataObject(String path, Map<String, Object> dataMap); static RPCHook getAclRPCHook(String fileName); }
AclUtils { public static boolean isScope(String netaddress, int index) { if (isColon(netaddress)) { netaddress = expandIP(netaddress, 8); String[] strArray = StringUtils.split(netaddress, ":"); return isIPv6Scope(strArray, index); } String[] strArray = StringUtils.split(netaddress, "."); if (strArray.length != 4) { return false; } return isScope(strArray, index); }  static byte[] combineRequestContent(RemotingCommand request, SortedMap<String, String> fieldsMap); static byte[] combineBytes(byte[] b1, byte[] b2); static String calSignature(byte[] data, String secretKey); static void IPv6AddressCheck(String netaddress); static String v6ipProcess(String netaddress, String[] strArray, int index); static void verify(String netaddress, int index); static String[] getAddreeStrArray(String netaddress, String partialAddress); static boolean isScope(String netaddress, int index); static boolean isScope(String[] num, int index); static boolean isColon(String netaddress); static boolean isScope(String num); static boolean isScope(int num); static boolean isAsterisk(String asterisk); static boolean isComma(String colon); static boolean isMinus(String minus); static boolean isIPv6Scope(String[] num, int index); static boolean isIPv6Scope(int num); static String expandIP(String netaddress, int part); static T getYamlDataObject(String path, Class<T> clazz); static boolean writeDataObject(String path, Map<String, Object> dataMap); static RPCHook getAclRPCHook(String fileName);  }