/** * Parse a key-value pair list. * * @param s the list * @return the map * @throws IllegalStateException if parsing failed */ public static HashMap<String, String> parseMap(String s) { HashMap<String, String> map = new HashMap<>(); StringBuilder buff = new StringBuilder(); for (int i = 0, size = s.length(); i < size;) { int startKey = i; i = s.indexOf(':', i); if (i < 0) { throw newIllegalStateException(ERROR_FILE_CORRUPT, "Not a map: {0}", s); } String key = s.substring(startKey, i++); i = parseMapValue(buff, s, i, size); map.put(key, buff.toString()); buff.setLength(0); } return map; }
parseMapValue(buff, s, i + 1, size); int check = (int) Long.parseLong(buff.toString(), 16); if (check == getFletcher32(bytes, start, startKey - 1)) { i = parseMapValue(buff, s, i, size); map.put(key, buff.toString()); buff.setLength(0);
parseMapValue(buff, s, i, size); return buff.toString(); } else {
/** * Parse a key-value pair list. * * @param s the list * @return the map * @throws IllegalStateException if parsing failed */ public static HashMap<String, String> parseMap(String s) { HashMap<String, String> map = new HashMap<>(); StringBuilder buff = new StringBuilder(); for (int i = 0, size = s.length(); i < size;) { int startKey = i; i = s.indexOf(':', i); if (i < 0) { throw newIllegalStateException(ERROR_FILE_CORRUPT, "Not a map: {0}", s); } String key = s.substring(startKey, i++); i = parseMapValue(buff, s, i, size); map.put(key, buff.toString()); buff.setLength(0); } return map; }
parseMapValue(buff, s, i + 1, size); int check = (int) Long.parseLong(buff.toString(), 16); if (check == getFletcher32(bytes, start, startKey - 1)) { i = parseMapValue(buff, s, i, size); map.put(key, buff.toString()); buff.setLength(0);
parseMapValue(buff, s, i, size); return buff.toString(); } else {