@Test public void print() { final ManifestParser mp = new ManifestParser(); try { ManifestInfo manifestInfo = mp.parse(new File("/Users/bin/Downloads/error.apk")); System.out.println(manifestInfo); } catch (IOException e) { e.printStackTrace(); } }
public ManifestInfo parse(File pFile) throws IOException { ManifestInfo manifestInfo = new ManifestInfo(); m_noback = false; ZipFile zipFile; InputStream aXMLInputStream = null; InputStream arscInputStream = null; try { zipFile = new ZipFile(pFile); ZipEntry zipEntry = zipFile.getEntry("AndroidManifest.xml"); if (zipEntry != null) { aXMLInputStream = zipFile.getInputStream(zipEntry); } else { manifestInfo = null; } zipEntry = zipFile.getEntry("resources.arsc"); if (zipEntry != null) { arscInputStream = zipFile.getInputStream(zipEntry); } if (arscInputStream != null) { m_arsc = IOUtils.toByteArray(arscInputStream); } } catch (IOException e) { throw new IOException(e.getMessage()); } if (aXMLInputStream != null) { try { parseManifest(aXMLInputStream, manifestInfo); manifestInfo.back = !m_noback; manifestInfo.xml = (m_xml == null) ? null : m_xml.toString(); } catch (IOException e) { e.printStackTrace(); return null; } } try { zipFile.close(); } catch (IOException e) { e.printStackTrace(); } if (aXMLInputStream != null) { try { aXMLInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if (arscInputStream != null) { try { arscInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return manifestInfo; }
ManifestParser { public ManifestInfo parse(File pFile) throws IOException { ManifestInfo manifestInfo = new ManifestInfo(); m_noback = false; ZipFile zipFile; InputStream aXMLInputStream = null; InputStream arscInputStream = null; try { zipFile = new ZipFile(pFile); ZipEntry zipEntry = zipFile.getEntry("AndroidManifest.xml"); if (zipEntry != null) { aXMLInputStream = zipFile.getInputStream(zipEntry); } else { manifestInfo = null; } zipEntry = zipFile.getEntry("resources.arsc"); if (zipEntry != null) { arscInputStream = zipFile.getInputStream(zipEntry); } if (arscInputStream != null) { m_arsc = IOUtils.toByteArray(arscInputStream); } } catch (IOException e) { throw new IOException(e.getMessage()); } if (aXMLInputStream != null) { try { parseManifest(aXMLInputStream, manifestInfo); manifestInfo.back = !m_noback; manifestInfo.xml = (m_xml == null) ? null : m_xml.toString(); } catch (IOException e) { e.printStackTrace(); return null; } } try { zipFile.close(); } catch (IOException e) { e.printStackTrace(); } if (aXMLInputStream != null) { try { aXMLInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if (arscInputStream != null) { try { arscInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return manifestInfo; } }
ManifestParser { public ManifestInfo parse(File pFile) throws IOException { ManifestInfo manifestInfo = new ManifestInfo(); m_noback = false; ZipFile zipFile; InputStream aXMLInputStream = null; InputStream arscInputStream = null; try { zipFile = new ZipFile(pFile); ZipEntry zipEntry = zipFile.getEntry("AndroidManifest.xml"); if (zipEntry != null) { aXMLInputStream = zipFile.getInputStream(zipEntry); } else { manifestInfo = null; } zipEntry = zipFile.getEntry("resources.arsc"); if (zipEntry != null) { arscInputStream = zipFile.getInputStream(zipEntry); } if (arscInputStream != null) { m_arsc = IOUtils.toByteArray(arscInputStream); } } catch (IOException e) { throw new IOException(e.getMessage()); } if (aXMLInputStream != null) { try { parseManifest(aXMLInputStream, manifestInfo); manifestInfo.back = !m_noback; manifestInfo.xml = (m_xml == null) ? null : m_xml.toString(); } catch (IOException e) { e.printStackTrace(); return null; } } try { zipFile.close(); } catch (IOException e) { e.printStackTrace(); } if (aXMLInputStream != null) { try { aXMLInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if (arscInputStream != null) { try { arscInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return manifestInfo; }  }
ManifestParser { public ManifestInfo parse(File pFile) throws IOException { ManifestInfo manifestInfo = new ManifestInfo(); m_noback = false; ZipFile zipFile; InputStream aXMLInputStream = null; InputStream arscInputStream = null; try { zipFile = new ZipFile(pFile); ZipEntry zipEntry = zipFile.getEntry("AndroidManifest.xml"); if (zipEntry != null) { aXMLInputStream = zipFile.getInputStream(zipEntry); } else { manifestInfo = null; } zipEntry = zipFile.getEntry("resources.arsc"); if (zipEntry != null) { arscInputStream = zipFile.getInputStream(zipEntry); } if (arscInputStream != null) { m_arsc = IOUtils.toByteArray(arscInputStream); } } catch (IOException e) { throw new IOException(e.getMessage()); } if (aXMLInputStream != null) { try { parseManifest(aXMLInputStream, manifestInfo); manifestInfo.back = !m_noback; manifestInfo.xml = (m_xml == null) ? null : m_xml.toString(); } catch (IOException e) { e.printStackTrace(); return null; } } try { zipFile.close(); } catch (IOException e) { e.printStackTrace(); } if (aXMLInputStream != null) { try { aXMLInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if (arscInputStream != null) { try { arscInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return manifestInfo; }  static float complexToFloat(int complex); ManifestInfo parse(File pFile); ManifestInfo parse(InputStream amInputStream, byte[] arscBytes); }
ManifestParser { public ManifestInfo parse(File pFile) throws IOException { ManifestInfo manifestInfo = new ManifestInfo(); m_noback = false; ZipFile zipFile; InputStream aXMLInputStream = null; InputStream arscInputStream = null; try { zipFile = new ZipFile(pFile); ZipEntry zipEntry = zipFile.getEntry("AndroidManifest.xml"); if (zipEntry != null) { aXMLInputStream = zipFile.getInputStream(zipEntry); } else { manifestInfo = null; } zipEntry = zipFile.getEntry("resources.arsc"); if (zipEntry != null) { arscInputStream = zipFile.getInputStream(zipEntry); } if (arscInputStream != null) { m_arsc = IOUtils.toByteArray(arscInputStream); } } catch (IOException e) { throw new IOException(e.getMessage()); } if (aXMLInputStream != null) { try { parseManifest(aXMLInputStream, manifestInfo); manifestInfo.back = !m_noback; manifestInfo.xml = (m_xml == null) ? null : m_xml.toString(); } catch (IOException e) { e.printStackTrace(); return null; } } try { zipFile.close(); } catch (IOException e) { e.printStackTrace(); } if (aXMLInputStream != null) { try { aXMLInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if (arscInputStream != null) { try { arscInputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return manifestInfo; }  static float complexToFloat(int complex); ManifestInfo parse(File pFile); ManifestInfo parse(InputStream amInputStream, byte[] arscBytes);  }