public AXMLResource(InputStream stream) throws IOException { chunks = new LinkedHashSet<Chunk>(); if (!read(stream)) { throw new IOException(); } }
public AXMLResource(InputStream stream) throws IOException { chunks = new LinkedHashSet<Chunk>(); if (!read(stream)) { throw new IOException(); } }
public AXMLResource(InputStream stream) throws IOException { chunks = new LinkedHashSet<Chunk>(); if (!read(stream)) { throw new IOException(); } }
public static String decodeManifest(File manifestFile){ FileInputStream in = null; try { AXMLResource axmlResource = new AXMLResource(); in = new FileInputStream(manifestFile); axmlResource.read(in); return axmlResource.toXmlString(); } catch (Exception e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(in); } return null; }
AXMLResource axmlResource = new AXMLResource(); fileInputStream = new FileInputStream(arguments[0]); axmlResource.read(fileInputStream);
AXMLResource axmlResource = new AXMLResource(); fileInputStream = new FileInputStream(arguments[0]); axmlResource.read(fileInputStream);
private String getDecodedXML() throws XmlPullParserException, IOException { //return new AXMLPrinter(inputFile.getContent()).getResult(); InputStream stream = inputFile.getStream(); if (stream != null) { AXMLResource axmlResource = new AXMLResource(); try { axmlResource.read(stream); String decoded = axmlResource.toXML(); stream.close(); return decoded; } catch (IOException e) { e.printStackTrace(); } } return null; }
@Test public void testReadingOldFiles() throws IOException { for (String file : oldTestFiles) { InputStream testStream = this.getClass().getClassLoader().getResourceAsStream(file); // Should throw no exceptions underTest.read(testStream); } }
@Test public void testInsertApplicationAttribute() throws IOException { InputStream testStream = this.getClass().getClassLoader().getResourceAsStream(largeFromMalware); underTest.read(testStream); Attribute attribute = new Attribute("android", "name", "test", AttributeType.STRING, null, underTest.getStringSection()); underTest.injectApplicationAttribute(attribute); StartTag startTag = underTest.getApplicationTag(); assertTrue(startTag.getAttributes().contains(attribute)); }
@Test public void testInsertApplicationAttribute() throws IOException { InputStream testStream = this.getClass().getClassLoader().getResourceAsStream(issue8); underTest.read(testStream); Attribute attribute = new Attribute("android", "name", "test", AttributeType.STRING, null, underTest.getStringSection()); underTest.injectApplicationAttribute(attribute); StartTag startTag = underTest.getApplicationTag(); assertTrue(startTag.getAttributes().contains(attribute)); }
@Test public void testWriteInsertedApplicationAttribute() throws IOException { InputStream testStream = this.getClass().getClassLoader().getResourceAsStream(issue8); underTest.read(testStream); Attribute attribute = new Attribute("android", "name", "test", AttributeType.STRING, null, underTest.getStringSection()); underTest.injectApplicationAttribute(attribute); File file = File.createTempFile("axml-func-test", "xml-test"); file.deleteOnExit(); underTest.write(new FileOutputStream(file)); underTest = new AXMLResource(new FileInputStream(file)); StartTag startTag = underTest.getApplicationTag(); assertEquals(underTest.getStringSection().getString(startTag.getAttributes().get(3).getNameIndex()), "name"); assertEquals(underTest.getStringSection().getString(startTag.getAttributes().get(3).getStringDataIndex()), "test"); } }
@Test public void testWriteInsertedApplicationAttribute() throws IOException { InputStream testStream = this.getClass().getClassLoader().getResourceAsStream(largeFromMalware); underTest.read(testStream); Attribute attribute = new Attribute("android", "name", "test", AttributeType.STRING, null, underTest.getStringSection()); underTest.injectApplicationAttribute(attribute); File file = File.createTempFile("axml-func-test", "xml-test"); file.deleteOnExit(); underTest.write(new FileOutputStream(file)); underTest = new AXMLResource(new FileInputStream(file)); StartTag startTag = underTest.getApplicationTag(); assertEquals(underTest.getStringSection().getString(startTag.getAttributes().get(3).getNameIndex()), "name"); assertEquals(underTest.getStringSection().getString(startTag.getAttributes().get(3).getStringDataIndex()), "test"); } }