use of org.jf.baksmali.formatter.BaksmaliFormatter in project smali by JesusFreke.
the class ListFieldOffsetsCommand method run.
@Override
public void run() {
if (help || inputList == null || inputList.isEmpty()) {
usage();
return;
}
if (inputList.size() > 1) {
System.err.println("Too many files specified");
usage();
return;
}
String input = inputList.get(0);
loadDexFile(input);
BaksmaliOptions options = getOptions();
BaksmaliFormatter formatter = new BaksmaliFormatter();
try {
for (ClassDef classDef : dexFile.getClasses()) {
ClassProto classProto = (ClassProto) options.classPath.getClass(classDef);
SparseArray<FieldReference> fields = classProto.getInstanceFields();
String className = "Class " + formatter.getType(classDef.getType()) + " : " + fields.size() + " instance fields\n";
System.out.write(className.getBytes());
for (int i = 0; i < fields.size(); i++) {
String field = fields.keyAt(i) + ":" + fields.valueAt(i).getType() + " " + fields.valueAt(i).getName() + "\n";
System.out.write(field.getBytes());
}
System.out.write("\n".getBytes());
}
System.out.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
use of org.jf.baksmali.formatter.BaksmaliFormatter in project smali by JesusFreke.
the class ListReferencesCommand method run.
@Override
public void run() {
if (help || inputList == null || inputList.isEmpty()) {
usage();
return;
}
if (inputList.size() > 1) {
System.err.println("Too many files specified");
usage();
return;
}
String input = inputList.get(0);
loadDexFile(input);
BaksmaliFormatter formatter = new BaksmaliFormatter();
for (Reference reference : dexFile.getReferences(referenceType)) {
System.out.println(formatter.getReference(reference));
}
}
use of org.jf.baksmali.formatter.BaksmaliFormatter in project smali by JesusFreke.
the class ListClassesCommand method run.
@Override
public void run() {
if (help || inputList == null || inputList.isEmpty()) {
usage();
return;
}
if (inputList.size() > 1) {
System.err.println("Too many files specified");
usage();
return;
}
String input = inputList.get(0);
loadDexFile(input);
BaksmaliFormatter formatter = new BaksmaliFormatter();
for (ClassDef classDef : dexFile.getClasses()) {
System.out.println(formatter.getType(classDef.getType()));
}
}
Aggregations