本文整理汇总了Java中org.jf.dexlib2.writer.io.FileDataStore类的典型用法代码示例。如果您正苦于以下问题:Java FileDataStore类的具体用法?Java FileDataStore怎么用?Java FileDataStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileDataStore类属于org.jf.dexlib2.writer.io包,在下文中一共展示了FileDataStore类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildCode
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
public static Set<String> buildCode(File smaliDir, File dexFile, DexDiffInfo info) throws IOException,
RecognitionException {
Set<String> classes = new HashSet<String>();
Set<DexBackedClassDef> classDefs = new HashSet<DexBackedClassDef>();
classDefs.addAll(info.getModifiedClasses());
classDefs.addAll(info.getAddedClasses());
final ClassFileNameHandler outFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali");
final ClassFileNameHandler inFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali");
DexBuilder dexBuilder = DexBuilder.makeDexBuilder();
File smaliFile;
String className;
for (DexBackedClassDef classDef : classDefs) {
ApkPatch.currentClassType = classDef.getType();
className = TypeGenUtil.newType(classDef.getType());
AfBakSmali.disassembleClass(classDef, outFileNameHandler, getBuildOption(classDefs, 19), false, false);
smaliFile = inFileNameHandler.getUniqueFilenameForClass(className);
classes.add(className.substring(1, className.length() - 1).replace('/', '.'));
SmaliMod.assembleSmaliFile(smaliFile, dexBuilder, true, true);
}
dexBuilder.writeTo(new FileDataStore(dexFile));
return classes;
}
示例2: writeTo
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
public static void writeTo(@Nonnull String path, @Nonnull org.jf.dexlib2.iface.DexFile input) throws IOException {
DexPool dexPool = makeDexPool();
for (ClassDef classDef: input.getClasses()) {
/*
* Modified(@CwT)
* The reason I modified this place(add continue here) is that I modified the function
* @link getClasses
* I want to add a filter and consequently drop some class which lead to return some null
* class. I just ignore here.
*/
if (classDef == null) {
continue;
}
((ClassPool)dexPool.classSection).intern(classDef);
}
dexPool.writeTo(new FileDataStore(new File(path)));
}
示例3: build
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
private void build() throws AndrolibException {
try {
DexBuilder dexBuilder = DexBuilder.makeDexBuilder();
for (String fileName : mSmaliDir.getDirectory().getFiles(true)) {
buildFile(fileName, dexBuilder);
}
dexBuilder.writeTo(new FileDataStore( new File(mDexFile.getAbsolutePath())));
} catch (IOException | DirectoryException ex) {
throw new AndrolibException(ex);
}
}
示例4: assembleSmaliFile
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
/**
* 将smali文件夹转换为dex文件
* @param smaliFolder
* @param outDexFile
* @return
*/
public static boolean assembleSmaliFile(File smaliFolder,File outDexFile) throws IOException, RecognitionException {
Collection<File> smaliFiles = FileUtils.listFiles(smaliFolder, new String[]{"smali"}, true);
if(null!= smaliFiles && smaliFiles.size() > 0){
DexBuilder dexBuilder = DexBuilder.makeDexBuilder();
for(File smaliFile:smaliFiles){
SmaliMod.assembleSmaliFile(smaliFile, dexBuilder, true, true);
}
dexBuilder.writeTo(new FileDataStore(outDexFile));
return true;
}else{
return false;
}
}
示例5: writeTo
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
public static void writeTo(@Nonnull String path, @Nonnull org.jf.dexlib2.iface.DexFile input) throws IOException {
DexPool dexPool = makeDexPool();
for (ClassDef classDef: input.getClasses()) {
((ClassPool)dexPool.classSection).intern(classDef);
}
dexPool.writeTo(new FileDataStore(new File(path)));
}
示例6: writeTo
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
public static void writeTo( String path, org.jf.dexlib2.iface.DexFile input) throws IOException {
DexPool dexPool = new DexPool(input.getOpcodes());
for (ClassDef classDef: input.getClasses()) {
dexPool.internClass(classDef);
}
dexPool.writeTo(new FileDataStore(new File(path)));
}
示例7: writeTo
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
public static void writeTo(@Nonnull String path, @Nonnull org.jf.dexlib2.iface.DexFile input) throws IOException {
DexPool dexPool = makeDexPool();
for (ClassDef classDef : input.getClasses()) {
((ClassPool) dexPool.classSection).intern(classDef);
}
dexPool.writeTo(new FileDataStore(new File(path)));
}
示例8: writeRawDexFile
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
public static void writeRawDexFile(File file, DexFile dexFile, int maxDexPoolSize, DexIO.Logger logger)
throws IOException {
DexIO.writeRawDexSingleThread(new FileDataStore(file), dexFile, maxDexPoolSize, logger, file);
}
示例9: writeTo
import org.jf.dexlib2.writer.io.FileDataStore; //导入依赖的package包/类
private void writeTo(String fileName) throws IOException {
FileDataStore fds = new FileDataStore(new File(fileName));
dexFile.writeTo(fds);
fds.close();
}