use of org.jf.dexlib.ClassDefItem in project otertool by wuntee.
the class SmaliWorkshop method getSmaliSource.
public static Map<String, File> getSmaliSource(File sourceSmaliOrDexFile, File destinationDirectory) throws IOException {
Map<String, File> ret = new HashMap<String, File>();
DexFile dexFile = new DexFile(sourceSmaliOrDexFile);
IndentingWriter idWriter;
for (ClassDefItem c : dexFile.ClassDefsSection.getItems()) {
File classFile = SmaliWorkshop.createSmaliClassFile(destinationDirectory, c);
String className = SmaliWorkshop.classDefItemToFilename(c);
logger.debug("Got class: " + className + " [" + classFile + "]");
BufferedWriter fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(classFile)));
idWriter = new IndentingWriter(fileWriter);
ClassDefinition cd = new ClassDefinition(c);
cd.writeTo(idWriter);
ret.put(className, classFile);
idWriter.close();
}
return (sortMapByKey(ret));
}
Aggregations