@Test public void parsePListToMap() throws FileNotFoundException { URL fileUrl = this.getClass().getClassLoader().getResource("back_test/test_info.plist"); if (fileUrl == null) { return; } String filePath = fileUrl.getPath(); File file = new File(filePath); if (file.exists()) { Map<String, Object> map = IpaUtil.parsePListToMap(new FileInputStream(file)); String str1 = "CFBundleIdentifier"; String str2 = "CFBundleVersion"; String str3 = "CFBundleDisplayName"; System.out.println(str1 + ": " + map.get(str1)); System.out.println(str2 + ": " + map.get(str2)); System.out.println(str3 + ": " + map.get(str3)); } }
@SuppressWarnings("unchecked") public static Map<String, Object> parsePListToMap(InputStream in) { if (in == null) { return null; } NSObject nsObject; try { nsObject = PropertyListParser.parse(in); } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) { logger.error("parsePListToMap, Exception: [{}]", e); return null; } finally { try { in.close(); } catch (IOException e) { logger.error("parsePListToMap, stream close IOException: [{}]", e); } } return (Map<String, Object>) nsObject.toJavaObject(); }
IpaUtil { @SuppressWarnings("unchecked") public static Map<String, Object> parsePListToMap(InputStream in) { if (in == null) { return null; } NSObject nsObject; try { nsObject = PropertyListParser.parse(in); } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) { logger.error("parsePListToMap, Exception: [{}]", e); return null; } finally { try { in.close(); } catch (IOException e) { logger.error("parsePListToMap, stream close IOException: [{}]", e); } } return (Map<String, Object>) nsObject.toJavaObject(); } }
IpaUtil { @SuppressWarnings("unchecked") public static Map<String, Object> parsePListToMap(InputStream in) { if (in == null) { return null; } NSObject nsObject; try { nsObject = PropertyListParser.parse(in); } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) { logger.error("parsePListToMap, Exception: [{}]", e); return null; } finally { try { in.close(); } catch (IOException e) { logger.error("parsePListToMap, stream close IOException: [{}]", e); } } return (Map<String, Object>) nsObject.toJavaObject(); }  }
IpaUtil { @SuppressWarnings("unchecked") public static Map<String, Object> parsePListToMap(InputStream in) { if (in == null) { return null; } NSObject nsObject; try { nsObject = PropertyListParser.parse(in); } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) { logger.error("parsePListToMap, Exception: [{}]", e); return null; } finally { try { in.close(); } catch (IOException e) { logger.error("parsePListToMap, stream close IOException: [{}]", e); } } return (Map<String, Object>) nsObject.toJavaObject(); }  @SuppressWarnings("unchecked") static Map<String, Object> parsePListToMap(InputStream in); @SuppressWarnings("unchecked") static Map<String, Object> parseMobileProvisionToMap(InputStream in); static String getFileContentByExecuteShell(String fileName); static IpaParseRes parseIpa(File file); static void parseAndStoreFile(File file, List<String> iconList, String path); static synchronized boolean changePlistContent(File originFile, File aimFile, String softwarePackageUrl, String displayImageUrl, String fullSizeImageUrl,
                                                          String bundleIdentifierValue, String bundleVersionValue, String titleValue); static Map<String, Object> generateDirByIpa(File ipaOriginFile, String ipaOriginFileName, String domain, String name); static ByteArrayOutputStream cloneInputStream(InputStream inputStream); }
IpaUtil { @SuppressWarnings("unchecked") public static Map<String, Object> parsePListToMap(InputStream in) { if (in == null) { return null; } NSObject nsObject; try { nsObject = PropertyListParser.parse(in); } catch (IOException | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException e) { logger.error("parsePListToMap, Exception: [{}]", e); return null; } finally { try { in.close(); } catch (IOException e) { logger.error("parsePListToMap, stream close IOException: [{}]", e); } } return (Map<String, Object>) nsObject.toJavaObject(); }  @SuppressWarnings("unchecked") static Map<String, Object> parsePListToMap(InputStream in); @SuppressWarnings("unchecked") static Map<String, Object> parseMobileProvisionToMap(InputStream in); static String getFileContentByExecuteShell(String fileName); static IpaParseRes parseIpa(File file); static void parseAndStoreFile(File file, List<String> iconList, String path); static synchronized boolean changePlistContent(File originFile, File aimFile, String softwarePackageUrl, String displayImageUrl, String fullSizeImageUrl,
                                                          String bundleIdentifierValue, String bundleVersionValue, String titleValue); static Map<String, Object> generateDirByIpa(File ipaOriginFile, String ipaOriginFileName, String domain, String name); static ByteArrayOutputStream cloneInputStream(InputStream inputStream);  }