public class IpaUtil {
public static Map<String, Object> readIPA(String ipaURL, String picturepath) {
Map<String, Object> map = new HashMap<String, Object>();
String newIconName = null;
try {
File file = new File(ipaURL);
InputStream is = new FileInputStream(file);
InputStream is2 = new FileInputStream(file);
ZipInputStream zipIns = new ZipInputStream(is);
ZipInputStream zipIns2 = new ZipInputStream(is2);
ZipEntry ze;
ZipEntry ze2;
InputStream infoIs = null;
NSDictionary rootDict = null;
String icon = null;
while ((ze = zipIns.getNextEntry()) != null) {
if (!ze.isDirectory()) {
String name = ze.getName();
if (null != name && name.toLowerCase().contains(".app/info.plist")) {
ByteArrayOutputStream _copy = new ByteArrayOutputStream();
int chunk = 0;
byte[] data = new byte[1024];
while (-1 != (chunk = zipIns.read(data))) {
_copy.write(data, 0, chunk);
}
infoIs = new ByteArrayInputStream(_copy.toByteArray());
rootDict = (NSDictionary)PropertyListParser.parse(infoIs);
NSDictionary iconDict = (NSDictionary)rootDict.get("CFBundleIcons");
if (rootDict.containsKey("CFBundleIconFiles")) {
NSArray CFBundleIconFiles = (NSArray)rootDict.get("CFBundleIconFiles");
NSObject[] array = CFBundleIconFiles.getArray();
if (!Utils.isArrayEmpty(array)) {
icon = CFBundleIconFiles.getArray()[array.length - 1].toString();
icon = icon.replace(".png", "");
if (null != icon) {
break;
}
}
}
// 获取图标名称
while (null != iconDict) {