@Test public void getAddreeStrArray() { String address = "1.1.1.{1,2,3,4}"; String[] addressArray = AclUtils.getAddreeStrArray(address, "{1,2,3,4}"); List<String> newAddressList = new ArrayList<>(); for (String a : addressArray) { newAddressList.add(a); } List<String> addressList = new ArrayList<>(); addressList.add("1.1.1.1"); addressList.add("1.1.1.2"); addressList.add("1.1.1.3"); addressList.add("1.1.1.4"); Assert.assertEquals(newAddressList, addressList); String ipv6Address = "1:ac41:9987::bb22:666:{1,2,3,4}"; String[] ipv6AddressArray = AclUtils.getAddreeStrArray(ipv6Address, "{1,2,3,4}"); List<String> newIPv6AddressList = new ArrayList<>(); for (String a : ipv6AddressArray) { newIPv6AddressList.add(a); } List<String> ipv6AddressList = new ArrayList<>(); ipv6AddressList.add("1:ac41:9987::bb22:666:1"); ipv6AddressList.add("1:ac41:9987::bb22:666:2"); ipv6AddressList.add("1:ac41:9987::bb22:666:3"); ipv6AddressList.add("1:ac41:9987::bb22:666:4"); Assert.assertEquals(newIPv6AddressList, ipv6AddressList); }
public static String[] getAddreeStrArray(String netaddress, String partialAddress) { String[] parAddStrArray = StringUtils.split(partialAddress.substring(1, partialAddress.length() - 1), ","); String address = netaddress.substring(0, netaddress.indexOf("{")); String[] addreeStrArray = new String[parAddStrArray.length]; for (int i = 0; i < parAddStrArray.length; i++) { addreeStrArray[i] = address + parAddStrArray[i]; } return addreeStrArray; }
AclUtils { public static String[] getAddreeStrArray(String netaddress, String partialAddress) { String[] parAddStrArray = StringUtils.split(partialAddress.substring(1, partialAddress.length() - 1), ","); String address = netaddress.substring(0, netaddress.indexOf("{")); String[] addreeStrArray = new String[parAddStrArray.length]; for (int i = 0; i < parAddStrArray.length; i++) { addreeStrArray[i] = address + parAddStrArray[i]; } return addreeStrArray; } }
AclUtils { public static String[] getAddreeStrArray(String netaddress, String partialAddress) { String[] parAddStrArray = StringUtils.split(partialAddress.substring(1, partialAddress.length() - 1), ","); String address = netaddress.substring(0, netaddress.indexOf("{")); String[] addreeStrArray = new String[parAddStrArray.length]; for (int i = 0; i < parAddStrArray.length; i++) { addreeStrArray[i] = address + parAddStrArray[i]; } return addreeStrArray; }  }
AclUtils { public static String[] getAddreeStrArray(String netaddress, String partialAddress) { String[] parAddStrArray = StringUtils.split(partialAddress.substring(1, partialAddress.length() - 1), ","); String address = netaddress.substring(0, netaddress.indexOf("{")); String[] addreeStrArray = new String[parAddStrArray.length]; for (int i = 0; i < parAddStrArray.length; i++) { addreeStrArray[i] = address + parAddStrArray[i]; } return addreeStrArray; }  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 String[] getAddreeStrArray(String netaddress, String partialAddress) { String[] parAddStrArray = StringUtils.split(partialAddress.substring(1, partialAddress.length() - 1), ","); String address = netaddress.substring(0, netaddress.indexOf("{")); String[] addreeStrArray = new String[parAddStrArray.length]; for (int i = 0; i < parAddStrArray.length; i++) { addreeStrArray[i] = address + parAddStrArray[i]; } return addreeStrArray; }  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);  }