• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ExtFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中brut.androlib.res.util.ExtFile的典型用法代码示例。如果您正苦于以下问题:Java ExtFile类的具体用法?Java ExtFile怎么用?Java ExtFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExtFile类属于brut.androlib.res.util包,在下文中一共展示了ExtFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: decodeRawFiles

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void decodeRawFiles(ExtFile apkFile, File outDir)
        throws AndrolibException {
    LOGGER.info("Copying assets and libs...");
    try {
        Directory in = apkFile.getDirectory();
        if (in.containsDir("assets")) {
            in.copyToDir(outDir, "assets");
        }
        if (in.containsDir("lib")) {
            in.copyToDir(outDir, "lib");
        }
        if (in.containsDir("libs")) {
            in.copyToDir(outDir, "libs");
        }
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:19,代码来源:Androlib.java


示例2: recordUncompressedFiles

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void recordUncompressedFiles(ExtFile apkFile, Collection<String> uncompressedFilesOrExts) throws AndrolibException {
    try {
        Directory unk = apkFile.getDirectory();
        Set<String> files = unk.getFiles(true);
        String ext;

        for (String file : files) {
            if (isAPKFileNames(file) && !NO_COMPRESS_PATTERN.matcher(file).find()) {
                if (unk.getCompressionLevel(file) == 0) {
                    ext = FilenameUtils.getExtension(file);
                    if (ext.isEmpty()) {
                        ext = file;
                    }
                    if (! uncompressedFilesOrExts.contains(ext)) {
                        uncompressedFilesOrExts.add(ext);
                    }
                }
            }
        }
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:24,代码来源:Androlib.java


示例3: decodeUnknownFiles

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void decodeUnknownFiles(ExtFile apkFile, File outDir, ResTable resTable)
        throws AndrolibException {
    LOGGER.info("Copying unknown files...");
    File unknownOut = new File(outDir, UNK_DIRNAME);
    try {
        Directory unk = apkFile.getDirectory();

        // loop all items in container recursively, ignoring any that are pre-defined by aapt
        Set<String> files = unk.getFiles(true);
        for (String file : files) {
            if (!isAPKFileNames(file) && !file.endsWith(".dex")) {

                // copy file out of archive into special "unknown" folder
                unk.copyToDir(unknownOut, file);
                // lets record the name of the file, and its compression type
                // so that we may re-include it the same way
                mResUnknownFiles.addUnknownFileInfo(file, String.valueOf(unk.getCompressionLevel(file)));
            }
        }
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:24,代码来源:Androlib.java


示例4: writeOriginalFiles

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void writeOriginalFiles(ExtFile apkFile, File outDir)
        throws AndrolibException {
    LOGGER.info("Copying original files...");
    File originalDir = new File(outDir, "original");
    if (!originalDir.exists()) {
        originalDir.mkdirs();
    }

    try {
        Directory in = apkFile.getDirectory();
        if(in.containsFile("AndroidManifest.xml")) {
            in.copyToDir(originalDir, "AndroidManifest.xml");
        }
        if (in.containsDir("META-INF")) {
            in.copyToDir(originalDir, "META-INF");
        }
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:21,代码来源:Androlib.java


示例5: buildSourcesSmali

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public boolean buildSourcesSmali(File appDir, String folder, String filename)
        throws AndrolibException {
    ExtFile smaliDir = new ExtFile(appDir, folder);
    if (!smaliDir.exists()) {
        return false;
    }
    File dex = new File(appDir, APK_DIRNAME + "/" + filename);
    if (! apkOptions.forceBuildAll) {
        LOGGER.info("Checking whether sources has changed...");
    }
    if (apkOptions.forceBuildAll || isModified(smaliDir, dex)) {
        LOGGER.info("Smaling " + folder + " folder into " + filename +"...");
        dex.delete();
        SmaliBuilder.build(smaliDir, dex);
    }
    return true;
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:18,代码来源:Androlib.java


示例6: buildResourcesRaw

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public boolean buildResourcesRaw(ExtFile appDir)
        throws AndrolibException {
    try {
        if (!new File(appDir, "resources.arsc").exists()) {
            return false;
        }
        File apkDir = new File(appDir, APK_DIRNAME);
        if (! apkOptions.forceBuildAll) {
            LOGGER.info("Checking whether resources has changed...");
        }
        if (apkOptions.forceBuildAll || isModified(newFiles(APK_RESOURCES_FILENAMES, appDir),
                newFiles(APK_RESOURCES_FILENAMES, apkDir))) {
            LOGGER.info("Copying raw resources...");
            appDir.getDirectory().copyToDir(apkDir, APK_RESOURCES_FILENAMES);
        }
        return true;
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:21,代码来源:Androlib.java


示例7: buildCopyOriginalFiles

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void buildCopyOriginalFiles(File appDir)
        throws AndrolibException {
    if (apkOptions.copyOriginalFiles) {
        File originalDir = new File(appDir, "original");
        if(originalDir.exists()) {
            try {
                LOGGER.info("Copy original files...");
                Directory in = (new ExtFile(originalDir)).getDirectory();
                if(in.containsFile("AndroidManifest.xml")) {
                    LOGGER.info("Copy AndroidManifest.xml...");
                    in.copyToDir(new File(appDir, APK_DIRNAME), "AndroidManifest.xml");
                }
                if (in.containsDir("META-INF")) {
                    LOGGER.info("Copy META-INF...");
                    in.copyToDir(new File(appDir, APK_DIRNAME), "META-INF");
                }
            } catch (DirectoryException ex) {
                throw new AndrolibException(ex);
            }
        }
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:23,代码来源:Androlib.java


示例8: loadFrameworkPkg

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public ResPackage loadFrameworkPkg(ResTable resTable, int id, String frameTag)
        throws AndrolibException {
    File apk = getFrameworkApk(id, frameTag);

    LOGGER.info("Loading resource table from file: " + apk);
    ResPackage[] pkgs = getResPackagesFromApk(new ExtFile(apk), resTable, true);

    ResPackage pkg;
    if (pkgs.length > 1) {
        pkg = selectPkgWithMostResSpecs(pkgs);
    } else if (pkgs.length == 0) {
        throw new AndrolibException("Arsc files with zero or multiple packages");
    } else {
        pkg = pkgs[0];
    }

    if (pkg.getId() != id) {
        throw new AndrolibException("Expected pkg of id: " + String.valueOf(id) + ", got: " + pkg.getId());
    }

    resTable.addPackage(pkg, false);
    return pkg;
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:24,代码来源:AndrolibResources.java


示例9: smali2dex

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
/**
 *  .smali转换.dex
 *
 * @param smaliDirPath      smali文件目录或zip文件路径
 * @param dexOutputPath     dex文件输出路径
 * @return 是否转换成功
 */
public static boolean smali2dex(String smaliDirPath, String dexOutputPath){
    ExtFile smaliDir = new ExtFile(new File(smaliDirPath));
    if (!smaliDir.exists()){
        LogUtils.w("smali2dex error : smali dir '" + smaliDirPath + "' is not exists");
        return false;
    }

    // 创建输出路径
    if (!FileHelper.makePath(dexOutputPath)){
        LogUtils.w("makePath error : dexOutputPath '" + dexOutputPath + "' make fail");
        return false;
    }

    File dexFile = new File(dexOutputPath);
    dexFile.delete();

    try {
        // smali -> dex
        SmaliBuilder.build(smaliDir, dexFile);
        return true;
    } catch (AndrolibException e) {
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:33,代码来源:ApkToolPlus.java


示例10: buildSourcesSmali

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public boolean buildSourcesSmali(File appDir, HashMap<String, Boolean> flags)
		throws AndrolibException {
	ExtFile smaliDir = new ExtFile(appDir, "smali");
	if (!smaliDir.exists()) {
		return false;
	}
	File dex = new File(appDir, APK_DIRNAME + "/classes.dex");
	if (!flags.get("forceBuildAll")) {
		LOGGER.info("Checking whether sources has changed...");
	}
	if (flags.get("forceBuildAll") || isModified(smaliDir, dex)) {
		LOGGER.info("Smaling...");
		dex.delete();
		SmaliBuilder.build(smaliDir, dex, flags);
	}
	return true;
}
 
开发者ID:Sukelluskello,项目名称:VectorAttackScanner,代码行数:18,代码来源:Androlib.java


示例11: buildResourcesRaw

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public boolean buildResourcesRaw(ExtFile appDir,
		HashMap<String, Boolean> flags) throws AndrolibException {
	try {
		if (!new File(appDir, "resources.arsc").exists()) {
			return false;
		}
		File apkDir = new File(appDir, APK_DIRNAME);
		if (!flags.get("forceBuildAll")) {
			LOGGER.info("Checking whether resources has changed...");
		}
		if (flags.get("forceBuildAll")
				|| isModified(newFiles(APK_RESOURCES_FILENAMES, appDir),
						newFiles(APK_RESOURCES_FILENAMES, apkDir))) {
			LOGGER.info("Copying raw resources...");
			appDir.getDirectory()
					.copyToDir(apkDir, APK_RESOURCES_FILENAMES);
		}
		return true;
	} catch (DirectoryException ex) {
		throw new AndrolibException(ex);
	}
}
 
开发者ID:Sukelluskello,项目名称:VectorAttackScanner,代码行数:23,代码来源:Androlib.java


示例12: checkIfLargeIntsAreHandledTest

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
@Test
public void checkIfLargeIntsAreHandledTest() throws BrutException, IOException {
    String apk = "issue767.apk";

    // decode issue767.apk
    ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + apk));
    sTestOrigDir = new ExtFile(sTmpDir + File.separator + apk + ".out");

    apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out"));
    apkDecoder.decode();

    // build issue767
    ExtFile testApk = new ExtFile(sTmpDir, apk + ".out");
    new Androlib().build(testApk, null);
    String newApk = apk + ".out" + File.separator + "dist" + File.separator + apk;

    // decode issue767 again
    apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + newApk));
    sTestNewDir = new ExtFile(sTmpDir + File.separator + apk + ".out.two");

    apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out.two"));
    apkDecoder.decode();

    compareXmlFiles("AndroidManifest.xml");
}
 
开发者ID:4455jkjh,项目名称:apktool-android,代码行数:26,代码来源:LargeIntsInManifestTest.java


示例13: beforeClass

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
    TestUtils.cleanFrameworkFile();

    sTmpDir = new ExtFile(OS.createTempDirectory());
    sTestOrigDir = new ExtFile(sTmpDir, "testapp-orig");
    sTestNewDir = new ExtFile(sTmpDir, "testapp-new");
    LOGGER.info("Unpacking testapp...");
    TestUtils.copyResourceDir(BuildAndDecodeTest.class, "brut/apktool/testapp/", sTestOrigDir);

    LOGGER.info("Building testapp.apk...");
    File testApk = new File(sTmpDir, "testapp.apk");
    new Androlib().build(sTestOrigDir, testApk);

    LOGGER.info("Decoding testapp.apk...");
    ApkDecoder apkDecoder = new ApkDecoder(testApk);
    apkDecoder.setOutDir(sTestNewDir);
    apkDecoder.decode();
}
 
开发者ID:4455jkjh,项目名称:apktool-android,代码行数:20,代码来源:BuildAndDecodeTest.java


示例14: beforeClass

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
    TestUtils.cleanFrameworkFile();
    sTmpDir = new ExtFile(OS.createTempDirectory());
    sTestOrigDir = new ExtFile(sTmpDir, "testjar-orig");
    sTestNewDir = new ExtFile(sTmpDir, "testjar-new");
    LOGGER.info("Unpacking testjar...");
    TestUtils.copyResourceDir(BuildAndDecodeJarTest.class, "brut/apktool/testjar/", sTestOrigDir);

    LOGGER.info("Building testjar.jar...");
    File testJar = new File(sTmpDir, "testjar.jar");
    new Androlib().build(sTestOrigDir, testJar);

    LOGGER.info("Decoding testjar.jar...");
    ApkDecoder apkDecoder = new ApkDecoder(testJar);
    apkDecoder.setOutDir(sTestNewDir);
    apkDecoder.decode();
}
 
开发者ID:4455jkjh,项目名称:apktool-android,代码行数:19,代码来源:BuildAndDecodeJarTest.java


示例15: beforeClass

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
    TestUtils.cleanFrameworkFile();
    sTmpDir = new ExtFile(OS.createTempDirectory());
    sTestOrigDir = new ExtFile(sTmpDir, "issue1235-orig");
    sTestNewDir = new ExtFile(sTmpDir, "issue1235-new");
    LOGGER.info("Unpacking issue1235...");
    TestUtils.copyResourceDir(BuildAndDecodeJarTest.class, "brut/apktool/issue1235/", sTestOrigDir);

    LOGGER.info("Building issue1235.apk...");
    ApkOptions apkOptions = new ApkOptions();
    apkOptions.debugMode = true;

    File testApk = new File(sTmpDir, "issue1235.apk");
    new Androlib(apkOptions).build(sTestOrigDir, testApk);

    LOGGER.info("Decoding issue1235.apk...");
    ApkDecoder apkDecoder = new ApkDecoder(testApk);
    apkDecoder.setOutDir(sTestNewDir);
    apkDecoder.decode();
}
 
开发者ID:4455jkjh,项目名称:apktool-android,代码行数:22,代码来源:DebugTagRetainedTest.java


示例16: decodeSourcesRaw

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void decodeSourcesRaw(ExtFile apkFile, File outDir, String filename)
        throws AndrolibException {
    try {
        LOGGER.info("Copying raw " + filename + " file...");
        apkFile.getDirectory().copyToDir(outDir, filename);
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:10,代码来源:Androlib.java


示例17: decodeManifestRaw

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void decodeManifestRaw(ExtFile apkFile, File outDir)
        throws AndrolibException {
    try {
        Directory apk = apkFile.getDirectory();
        LOGGER.info("Copying raw manifest...");
        apkFile.getDirectory().copyToDir(outDir, APK_MANIFEST_FILENAMES);
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:11,代码来源:Androlib.java


示例18: decodeResourcesRaw

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void decodeResourcesRaw(ExtFile apkFile, File outDir)
        throws AndrolibException {
    try {
        LOGGER.info("Copying raw resources...");
        apkFile.getDirectory().copyToDir(outDir, APK_RESOURCES_FILENAMES);
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:10,代码来源:Androlib.java


示例19: readMetaFile

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public MetaInfo readMetaFile(ExtFile appDir)
        throws AndrolibException {
    try {
        InputStream in = appDir.getDirectory().getFileInput("apktool.yml");
        return MetaInfo.load(in);
    } catch (DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:10,代码来源:Androlib.java


示例20: buildNonDefaultSources

import brut.androlib.res.util.ExtFile; //导入依赖的package包/类
public void buildNonDefaultSources(ExtFile appDir)
        throws AndrolibException {
    try {
        // loop through any smali_ directories for multi-dex apks
        Map<String, Directory> dirs = appDir.getDirectory().getDirs();
        for (Map.Entry<String, Directory> directory : dirs.entrySet()) {
            String name = directory.getKey();
            if (name.startsWith("smali_")) {
                String filename = name.substring(name.indexOf("_") + 1) + ".dex";

                if (!buildSourcesRaw(appDir, filename) && !buildSourcesSmali(appDir, name, filename)) {
                    LOGGER.warning("Could not find sources");
                }
            }
        }

        // loop through any classes#.dex files for multi-dex apks
        File[] dexFiles = appDir.listFiles();
        if (dexFiles != null) {
            for (File dex : dexFiles) {

                // skip classes.dex because we have handled it in buildSources()
                if (dex.getName().endsWith(".dex") && ! dex.getName().equalsIgnoreCase("classes.dex")) {
                    buildSourcesRaw(appDir, dex.getName());
                }
            }
        }
    } catch(DirectoryException ex) {
        throw new AndrolibException(ex);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:32,代码来源:Androlib.java



注:本文中的brut.androlib.res.util.ExtFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractXMLStreamWriter类代码示例发布时间:2022-05-22
下一篇:
Java CachePoolEntryProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap