mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 00:54:25 +02:00
delete IndentingPrintWriter and refactor everything to use IndentingWriter directly
git-svn-id: https://smali.googlecode.com/svn/trunk@688 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
bf483ac86d
commit
0b2f7d6a57
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.AnnotationItem;
|
||||
import org.jf.baksmali.Adaptors.EncodedValue.AnnotationEncodedValueAdaptor;
|
||||
import org.jf.dexlib.AnnotationSetItem;
|
||||
@ -38,11 +38,11 @@ import java.io.IOException;
|
||||
|
||||
public class AnnotationFormatter {
|
||||
|
||||
public static void writeTo(IndentingPrintWriter writer, AnnotationSetItem annotationSet) throws IOException {
|
||||
public static void writeTo(IndentingWriter writer, AnnotationSetItem annotationSet) throws IOException {
|
||||
boolean first = true;
|
||||
for (AnnotationItem annotationItem: annotationSet.getAnnotations()) {
|
||||
if (!first) {
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
first = false;
|
||||
|
||||
@ -50,15 +50,15 @@ public class AnnotationFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeTo(IndentingPrintWriter writer, AnnotationItem annotationItem) throws IOException {
|
||||
public static void writeTo(IndentingWriter writer, AnnotationItem annotationItem) throws IOException {
|
||||
writer.write(".annotation ");
|
||||
writer.write(annotationItem.getVisibility().visibility);
|
||||
writer.write(' ');
|
||||
ReferenceFormatter.writeTypeReference(writer, annotationItem.getEncodedAnnotation().annotationType);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
|
||||
AnnotationEncodedValueAdaptor.writeElementsTo(writer, annotationItem.getEncodedAnnotation());
|
||||
|
||||
writer.println(".end annotation");
|
||||
writer.write(".end annotation\n");
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
//a "spacer" between instructions
|
||||
public class BlankMethodItem extends MethodItem {
|
||||
@ -40,7 +40,7 @@ public class BlankMethodItem extends MethodItem {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public boolean writeTo(IndentingPrintWriter writer) {
|
||||
public boolean writeTo(IndentingWriter writer) {
|
||||
//we didn't technically print something, but returning true indicates that a newline should be printed
|
||||
//after this method item, which is the intended functionality
|
||||
return true;
|
||||
|
@ -28,9 +28,11 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.TypeIdItem;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CatchMethodItem extends MethodItem {
|
||||
private final TypeIdItem exceptionType;
|
||||
|
||||
@ -76,7 +78,7 @@ public class CatchMethodItem extends MethodItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
if (exceptionType == null) {
|
||||
writer.write(".catchall");
|
||||
} else {
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.Code.Analysis.ValidationException;
|
||||
import org.jf.dexlib.EncodedValue.EncodedValue;
|
||||
import org.jf.dexlib.*;
|
||||
@ -124,7 +124,7 @@ public class ClassDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
public void writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public void writeTo(IndentingWriter writer) throws IOException {
|
||||
writeClass(writer);
|
||||
writeSuper(writer);
|
||||
writeSourceFile(writer);
|
||||
@ -137,37 +137,39 @@ public class ClassDefinition {
|
||||
return ;
|
||||
}
|
||||
|
||||
private void writeClass(IndentingPrintWriter writer) {
|
||||
private void writeClass(IndentingWriter writer) throws IOException {
|
||||
writer.write(".class ");
|
||||
writeAccessFlags(writer);
|
||||
writer.println(classDefItem.getClassType().getTypeDescriptor());
|
||||
writer.write(classDefItem.getClassType().getTypeDescriptor());
|
||||
writer.write('\n');
|
||||
}
|
||||
|
||||
private void writeAccessFlags(IndentingPrintWriter writer) {
|
||||
private void writeAccessFlags(IndentingWriter writer) throws IOException {
|
||||
for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForClass(classDefItem.getAccessFlags())) {
|
||||
writer.write(accessFlag.toString());
|
||||
writer.write(' ');
|
||||
}
|
||||
}
|
||||
|
||||
private void writeSuper(IndentingPrintWriter writer) {
|
||||
private void writeSuper(IndentingWriter writer) throws IOException {
|
||||
TypeIdItem superClass = classDefItem.getSuperclass();
|
||||
if (superClass != null) {
|
||||
writer.write(".super ");
|
||||
writer.println(superClass.getTypeDescriptor());
|
||||
writer.write(superClass.getTypeDescriptor());
|
||||
writer.write('\n');
|
||||
}
|
||||
}
|
||||
|
||||
private void writeSourceFile(IndentingPrintWriter writer) {
|
||||
private void writeSourceFile(IndentingWriter writer) throws IOException {
|
||||
StringIdItem sourceFile = classDefItem.getSourceFile();
|
||||
if (sourceFile != null) {
|
||||
writer.write(".source \"");
|
||||
writer.print(sourceFile.getStringValue());
|
||||
writer.println('"');
|
||||
writer.write(sourceFile.getStringValue());
|
||||
writer.write("\"\n");
|
||||
}
|
||||
}
|
||||
|
||||
private void writeInterfaces(IndentingPrintWriter writer) {
|
||||
private void writeInterfaces(IndentingWriter writer) throws IOException {
|
||||
TypeListItem interfaceList = classDefItem.getInterfaces();
|
||||
if (interfaceList == null) {
|
||||
return;
|
||||
@ -178,15 +180,16 @@ public class ClassDefinition {
|
||||
return;
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.println("# interfaces");
|
||||
writer.write('\n');
|
||||
writer.write("# interfaces\n");
|
||||
for (TypeIdItem typeIdItem: interfaceList.getTypes()) {
|
||||
writer.write(".implements ");
|
||||
writer.println(typeIdItem.getTypeDescriptor());
|
||||
writer.write(typeIdItem.getTypeDescriptor());
|
||||
writer.write('\n');
|
||||
}
|
||||
}
|
||||
|
||||
private void writeAnnotations(IndentingPrintWriter writer) throws IOException {
|
||||
private void writeAnnotations(IndentingWriter writer) throws IOException {
|
||||
AnnotationDirectoryItem annotationDirectory = classDefItem.getAnnotations();
|
||||
if (annotationDirectory == null) {
|
||||
return;
|
||||
@ -197,13 +200,12 @@ public class ClassDefinition {
|
||||
return;
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.println();
|
||||
writer.println("# annotations");
|
||||
writer.write("\n\n");
|
||||
writer.write("# annotations\n");
|
||||
AnnotationFormatter.writeTo(writer, annotationSet);
|
||||
}
|
||||
|
||||
private void writeStaticFields(IndentingPrintWriter writer) throws IOException {
|
||||
private void writeStaticFields(IndentingWriter writer) throws IOException {
|
||||
if (classDataItem == null) {
|
||||
return;
|
||||
}
|
||||
@ -224,14 +226,13 @@ public class ClassDefinition {
|
||||
return;
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.println();
|
||||
writer.println("# static fields");
|
||||
writer.write("\n\n");
|
||||
writer.write("# static fields\n");
|
||||
|
||||
boolean first = true;
|
||||
for (int i=0; i<encodedFields.length; i++) {
|
||||
if (!first) {
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
first = false;
|
||||
|
||||
@ -249,7 +250,7 @@ public class ClassDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
private void writeInstanceFields(IndentingPrintWriter writer) throws IOException {
|
||||
private void writeInstanceFields(IndentingWriter writer) throws IOException {
|
||||
if (classDataItem == null) {
|
||||
return;
|
||||
}
|
||||
@ -259,13 +260,12 @@ public class ClassDefinition {
|
||||
return;
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.println();
|
||||
writer.println("# instance fields");
|
||||
writer.write("\n\n");
|
||||
writer.write("# instance fields\n");
|
||||
boolean first = true;
|
||||
for (ClassDataItem.EncodedField field: classDataItem.getInstanceFields()) {
|
||||
if (!first) {
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
first = false;
|
||||
|
||||
@ -275,7 +275,7 @@ public class ClassDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
private void writeDirectMethods(IndentingPrintWriter writer) throws IOException {
|
||||
private void writeDirectMethods(IndentingWriter writer) throws IOException {
|
||||
if (classDataItem == null) {
|
||||
return;
|
||||
}
|
||||
@ -286,13 +286,12 @@ public class ClassDefinition {
|
||||
return;
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.println();
|
||||
writer.println("# direct methods");
|
||||
writer.write("\n\n");
|
||||
writer.write("# direct methods\n");
|
||||
writeMethods(writer, directMethods);
|
||||
}
|
||||
|
||||
private void writeVirtualMethods(IndentingPrintWriter writer) throws IOException {
|
||||
private void writeVirtualMethods(IndentingWriter writer) throws IOException {
|
||||
if (classDataItem == null) {
|
||||
return;
|
||||
}
|
||||
@ -303,17 +302,16 @@ public class ClassDefinition {
|
||||
return;
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.println();
|
||||
writer.println("# virtual methods");
|
||||
writer.write("\n\n");
|
||||
writer.write("# virtual methods\n");
|
||||
writeMethods(writer, virtualMethods);
|
||||
}
|
||||
|
||||
private void writeMethods(IndentingPrintWriter writer, ClassDataItem.EncodedMethod[] methods) throws IOException {
|
||||
private void writeMethods(IndentingWriter writer, ClassDataItem.EncodedMethod[] methods) throws IOException {
|
||||
boolean first = true;
|
||||
for (ClassDataItem.EncodedMethod method: methods) {
|
||||
if (!first) {
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
first = false;
|
||||
|
||||
|
@ -28,7 +28,9 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CommentMethodItem extends MethodItem {
|
||||
//private final StringTemplate template;
|
||||
@ -45,7 +47,7 @@ public class CommentMethodItem extends MethodItem {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
public boolean writeTo(IndentingPrintWriter writer) {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writer.write('#');
|
||||
writer.write(comment);
|
||||
return true;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -44,7 +44,7 @@ public class CommentedOutMethodItem extends MethodItem {
|
||||
return commentedOutMethodItem.getSortOrder() + .001;
|
||||
}
|
||||
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writer.write('#');
|
||||
commentedOutMethodItem.writeTo(writer);
|
||||
return true;
|
||||
|
@ -28,11 +28,13 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
import org.jf.dexlib.StringIdItem;
|
||||
import org.jf.dexlib.TypeIdItem;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class DebugMethodItem extends MethodItem {
|
||||
private final double sortOrder;
|
||||
|
||||
@ -45,21 +47,22 @@ public abstract class DebugMethodItem extends MethodItem {
|
||||
return sortOrder;
|
||||
}
|
||||
|
||||
protected static void writeLine(IndentingPrintWriter writer, int line) {
|
||||
protected static void writeLine(IndentingWriter writer, int line) throws IOException {
|
||||
writer.write(".line ");
|
||||
writer.print(line);
|
||||
writer.printIntAsDec(line);
|
||||
}
|
||||
|
||||
protected static void writeEndPrologue(IndentingPrintWriter writer) {
|
||||
protected static void writeEndPrologue(IndentingWriter writer) throws IOException {
|
||||
writer.write(".prologue");
|
||||
}
|
||||
|
||||
protected static void writeBeginEpilogue(IndentingPrintWriter writer) {
|
||||
protected static void writeBeginEpilogue(IndentingWriter writer) throws IOException {
|
||||
writer.write(".epilogue");
|
||||
}
|
||||
|
||||
protected static void writeStartLocal(IndentingPrintWriter writer, CodeItem codeItem, int register,
|
||||
StringIdItem name, TypeIdItem type, StringIdItem signature) {
|
||||
protected static void writeStartLocal(IndentingWriter writer, CodeItem codeItem, int register,
|
||||
StringIdItem name, TypeIdItem type, StringIdItem signature)
|
||||
throws IOException {
|
||||
writer.write(".local ");
|
||||
RegisterFormatter.writeTo(writer, codeItem, register);
|
||||
writer.write(", ");
|
||||
@ -73,8 +76,8 @@ public abstract class DebugMethodItem extends MethodItem {
|
||||
}
|
||||
}
|
||||
|
||||
protected static void writeEndLocal(IndentingPrintWriter writer, CodeItem codeItem, int register, StringIdItem name,
|
||||
TypeIdItem type, StringIdItem signature) {
|
||||
protected static void writeEndLocal(IndentingWriter writer, CodeItem codeItem, int register, StringIdItem name,
|
||||
TypeIdItem type, StringIdItem signature) throws IOException {
|
||||
writer.write(".end local ");
|
||||
RegisterFormatter.writeTo(writer, codeItem, register);
|
||||
|
||||
@ -92,8 +95,9 @@ public abstract class DebugMethodItem extends MethodItem {
|
||||
}
|
||||
|
||||
|
||||
protected static void writeRestartLocal(IndentingPrintWriter writer, CodeItem codeItem, int register,
|
||||
StringIdItem name, TypeIdItem type, StringIdItem signature) {
|
||||
protected static void writeRestartLocal(IndentingWriter writer, CodeItem codeItem, int register,
|
||||
StringIdItem name, TypeIdItem type, StringIdItem signature)
|
||||
throws IOException {
|
||||
writer.write(".restart local ");
|
||||
RegisterFormatter.writeTo(writer, codeItem, register);
|
||||
|
||||
@ -110,7 +114,7 @@ public abstract class DebugMethodItem extends MethodItem {
|
||||
}
|
||||
}
|
||||
|
||||
protected static void writeSetFile(IndentingPrintWriter writer, String fileName) {
|
||||
protected static void writeSetFile(IndentingWriter writer, String fileName) throws IOException {
|
||||
writer.write(".source \"");
|
||||
writer.write(fileName);
|
||||
writer.write('"');
|
||||
|
@ -29,24 +29,24 @@
|
||||
package org.jf.baksmali.Adaptors.EncodedValue;
|
||||
|
||||
import org.jf.baksmali.Adaptors.ReferenceFormatter;
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.EncodedValue.AnnotationEncodedSubValue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class AnnotationEncodedValueAdaptor {
|
||||
|
||||
public static void writeTo(IndentingPrintWriter writer, AnnotationEncodedSubValue encodedAnnotation)
|
||||
public static void writeTo(IndentingWriter writer, AnnotationEncodedSubValue encodedAnnotation)
|
||||
throws IOException {
|
||||
writer.write(".subannotation ");
|
||||
ReferenceFormatter.writeTypeReference(writer, encodedAnnotation.annotationType);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
|
||||
writeElementsTo(writer, encodedAnnotation);
|
||||
writer.write(".end subannotation");
|
||||
}
|
||||
|
||||
public static void writeElementsTo(IndentingPrintWriter writer, AnnotationEncodedSubValue encodedAnnotation)
|
||||
public static void writeElementsTo(IndentingWriter writer, AnnotationEncodedSubValue encodedAnnotation)
|
||||
throws IOException {
|
||||
writer.indent(4);
|
||||
for (int i=0; i<encodedAnnotation.names.length; i++) {
|
||||
@ -54,7 +54,7 @@ public abstract class AnnotationEncodedValueAdaptor {
|
||||
writer.write(" = ");
|
||||
|
||||
EncodedValueAdaptor.writeTo(writer, encodedAnnotation.values[i]);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.deindent(4);
|
||||
}
|
||||
|
@ -28,34 +28,33 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors.EncodedValue;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.EncodedValue.EncodedValue;
|
||||
import org.jf.dexlib.EncodedValue.ArrayEncodedValue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ArrayEncodedValueAdaptor {
|
||||
public static void writeTo(IndentingPrintWriter writer, ArrayEncodedValue encodedArray) throws IOException {
|
||||
writer.print('{');
|
||||
public static void writeTo(IndentingWriter writer, ArrayEncodedValue encodedArray) throws IOException {
|
||||
writer.write('{');
|
||||
EncodedValue[] values = encodedArray.values;
|
||||
if (values == null || values.length == 0) {
|
||||
writer.print('}');
|
||||
writer.write('}');
|
||||
return;
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
writer.indent(4);
|
||||
boolean first = true;
|
||||
for (EncodedValue encodedValue: encodedArray.values) {
|
||||
if (!first) {
|
||||
writer.println(',');
|
||||
writer.write(",\n");
|
||||
}
|
||||
first = false;
|
||||
|
||||
EncodedValueAdaptor.writeTo(writer, encodedValue);
|
||||
}
|
||||
writer.deindent(4);
|
||||
writer.println();
|
||||
writer.print('}');
|
||||
writer.write("\n}");
|
||||
}
|
||||
}
|
||||
|
@ -29,14 +29,14 @@
|
||||
package org.jf.baksmali.Adaptors.EncodedValue;
|
||||
|
||||
import org.jf.baksmali.Adaptors.ReferenceFormatter;
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.Renderers.*;
|
||||
import org.jf.dexlib.EncodedValue.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class EncodedValueAdaptor {
|
||||
public static void writeTo(IndentingPrintWriter writer, EncodedValue encodedValue) throws IOException {
|
||||
public static void writeTo(IndentingWriter writer, EncodedValue encodedValue) throws IOException {
|
||||
switch (encodedValue.getValueType()) {
|
||||
case VALUE_ANNOTATION:
|
||||
AnnotationEncodedValueAdaptor.writeTo(writer, (AnnotationEncodedValue)encodedValue);
|
||||
|
@ -29,13 +29,13 @@
|
||||
package org.jf.baksmali.Adaptors.EncodedValue;
|
||||
|
||||
import org.jf.baksmali.Adaptors.ReferenceFormatter;
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.FieldIdItem;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class EnumEncodedValueAdaptor {
|
||||
public static void writeTo(IndentingPrintWriter writer, FieldIdItem item) throws IOException {
|
||||
public static void writeTo(IndentingWriter writer, FieldIdItem item) throws IOException {
|
||||
writer.write(".enum ");
|
||||
ReferenceFormatter.writeFieldReference(writer, item);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.Adaptors.EncodedValue.EncodedValueAdaptor;
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.ClassDataItem;
|
||||
import org.jf.dexlib.EncodedValue.EncodedValue;
|
||||
import org.jf.dexlib.EncodedValue.NullEncodedValue;
|
||||
@ -39,7 +39,7 @@ import org.jf.dexlib.Util.AccessFlags;
|
||||
import java.io.IOException;
|
||||
|
||||
public class FieldDefinition {
|
||||
public static void writeTo(IndentingPrintWriter writer, ClassDataItem.EncodedField encodedField,
|
||||
public static void writeTo(IndentingWriter writer, ClassDataItem.EncodedField encodedField,
|
||||
EncodedValue initialValue, AnnotationSetItem annotationSet,
|
||||
boolean setInStaticConstructor) throws IOException {
|
||||
|
||||
@ -55,7 +55,7 @@ public class FieldDefinition {
|
||||
initialValue != NullEncodedValue.NullValue
|
||||
)) {
|
||||
|
||||
writer.println("#the value of this static final field might be set in the static constructor");
|
||||
writer.write("#the value of this static final field might be set in the static constructor\n");
|
||||
}
|
||||
|
||||
writer.write(".field ");
|
||||
@ -68,17 +68,18 @@ public class FieldDefinition {
|
||||
EncodedValueAdaptor.writeTo(writer, initialValue);
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
|
||||
if (annotationSet != null) {
|
||||
writer.indent(4);
|
||||
AnnotationFormatter.writeTo(writer, annotationSet);
|
||||
writer.deindent(4);
|
||||
writer.println(".end field");
|
||||
writer.write(".end field\n");
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeAccessFlags(IndentingPrintWriter writer, ClassDataItem.EncodedField encodedField) {
|
||||
private static void writeAccessFlags(IndentingWriter writer, ClassDataItem.EncodedField encodedField)
|
||||
throws IOException {
|
||||
for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForField(encodedField.accessFlags)) {
|
||||
writer.write(accessFlag.toString());
|
||||
writer.write(' ');
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors.Format;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.Renderers.ByteRenderer;
|
||||
import org.jf.dexlib.Code.Format.ArrayDataPseudoInstruction;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
@ -45,11 +45,11 @@ public class ArrayDataMethodItem extends InstructionMethodItem<ArrayDataPseudoIn
|
||||
this.dead = dead;
|
||||
}
|
||||
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
if (dead) {
|
||||
writer.print("#.array-data 0x");
|
||||
writer.write("#.array-data 0x");
|
||||
writer.printLongAsHex(instruction.getElementWidth());
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
|
||||
Iterator<ArrayDataPseudoInstruction.ArrayElement> iterator = instruction.getElements();
|
||||
while (iterator.hasNext()) {
|
||||
@ -62,13 +62,13 @@ public class ArrayDataMethodItem extends InstructionMethodItem<ArrayDataPseudoIn
|
||||
}
|
||||
ByteRenderer.writeUnsignedTo(writer, element.buffer[element.bufferIndex+i]);
|
||||
}
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.print("#.end array-data");
|
||||
writer.write("#.end array-data");
|
||||
} else {
|
||||
writer.print(".array-data 0x");
|
||||
writer.write(".array-data 0x");
|
||||
writer.printLongAsHex(instruction.getElementWidth());
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
|
||||
writer.indent(4);
|
||||
Iterator<ArrayDataPseudoInstruction.ArrayElement> iterator = instruction.getElements();
|
||||
@ -81,10 +81,10 @@ public class ArrayDataMethodItem extends InstructionMethodItem<ArrayDataPseudoIn
|
||||
}
|
||||
ByteRenderer.writeUnsignedTo(writer, element.buffer[element.bufferIndex+i]);
|
||||
}
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.deindent(4);
|
||||
writer.print(".end array-data");
|
||||
writer.write(".end array-data");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ package org.jf.baksmali.Adaptors.Format;
|
||||
import org.jf.baksmali.Adaptors.MethodItem;
|
||||
import org.jf.baksmali.Adaptors.ReferenceFormatter;
|
||||
import org.jf.baksmali.Adaptors.RegisterFormatter;
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.Renderers.LongRenderer;
|
||||
import org.jf.dexlib.*;
|
||||
import org.jf.dexlib.Code.*;
|
||||
@ -54,7 +54,7 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
switch (instruction.getFormat()) {
|
||||
case Format10t:
|
||||
writeOpcode(writer);
|
||||
@ -203,33 +203,33 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void writeOpcode(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeOpcode(IndentingWriter writer) throws IOException {
|
||||
writer.write(instruction.opcode.name);
|
||||
}
|
||||
|
||||
protected void writeTargetLabel(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeTargetLabel(IndentingWriter writer) throws IOException {
|
||||
//this method is overrided by OffsetInstructionMethodItem, and should only be called for the formats that
|
||||
//have a target
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
protected void writeRegister(IndentingPrintWriter writer, int registerNumber) throws IOException {
|
||||
protected void writeRegister(IndentingWriter writer, int registerNumber) throws IOException {
|
||||
RegisterFormatter.writeTo(writer, codeItem, registerNumber);
|
||||
}
|
||||
|
||||
protected void writeFirstRegister(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeFirstRegister(IndentingWriter writer) throws IOException {
|
||||
writeRegister(writer, ((SingleRegisterInstruction)instruction).getRegisterA());
|
||||
}
|
||||
|
||||
protected void writeSecondRegister(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeSecondRegister(IndentingWriter writer) throws IOException {
|
||||
writeRegister(writer, ((TwoRegisterInstruction)instruction).getRegisterB());
|
||||
}
|
||||
|
||||
protected void writeThirdRegister(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeThirdRegister(IndentingWriter writer) throws IOException {
|
||||
writeRegister(writer, ((ThreeRegisterInstruction)instruction).getRegisterC());
|
||||
}
|
||||
|
||||
protected void writeInvokeRegisters(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeInvokeRegisters(IndentingWriter writer) throws IOException {
|
||||
FiveRegisterInstruction instruction = (FiveRegisterInstruction)this.instruction;
|
||||
final int regCount = instruction.getRegCount();
|
||||
|
||||
@ -274,7 +274,7 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
|
||||
writer.write('}');
|
||||
}
|
||||
|
||||
protected void writeInvokeRangeRegisters(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeInvokeRangeRegisters(IndentingWriter writer) throws IOException {
|
||||
RegisterRangeInstruction instruction = (RegisterRangeInstruction)this.instruction;
|
||||
|
||||
int regCount = instruction.getRegCount();
|
||||
@ -286,21 +286,21 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
|
||||
}
|
||||
}
|
||||
|
||||
protected void writeLiteral(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeLiteral(IndentingWriter writer) throws IOException {
|
||||
LongRenderer.writeSignedIntOrLongTo(writer, ((LiteralInstruction)instruction).getLiteral());
|
||||
}
|
||||
|
||||
protected void writeFieldOffset(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeFieldOffset(IndentingWriter writer) throws IOException {
|
||||
writer.write("field@0x");
|
||||
writer.printLongAsHex(((OdexedFieldAccess)instruction).getFieldOffset());
|
||||
}
|
||||
|
||||
protected void writeVtableIndex(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeVtableIndex(IndentingWriter writer) throws IOException {
|
||||
writer.write("vtable@0x");
|
||||
writer.printLongAsHex(((OdexedInvokeVirtual)instruction).getMethodIndex());
|
||||
}
|
||||
|
||||
protected void writeReference(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeReference(IndentingWriter writer) throws IOException {
|
||||
Item item = ((InstructionWithReference)instruction).getReferencedItem();
|
||||
ReferenceFormatter.writeReference(writer, item);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors.Format;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.Code.Opcode;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
import org.jf.dexlib.Code.Instruction;
|
||||
@ -52,7 +52,7 @@ public class OffsetInstructionFormatMethodItem<T extends Instruction & OffsetIns
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeTargetLabel(IndentingPrintWriter writer) throws IOException {
|
||||
protected void writeTargetLabel(IndentingWriter writer) throws IOException {
|
||||
label.writeTo(writer);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors.Format;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.Renderers.IntegerRenderer;
|
||||
import org.jf.dexlib.Code.Format.PackedSwitchDataPseudoInstruction;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
@ -65,25 +65,25 @@ public class PackedSwitchMethodItem extends InstructionMethodItem<PackedSwitchDa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
if (dead) {
|
||||
writer.write("'#.packed-switch ");
|
||||
IntegerRenderer.writeTo(writer, instruction.getFirstKey());
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
for (LabelMethodItem label: labels) {
|
||||
writer.write("# ");
|
||||
label.writeTo(writer);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.write("#.end packed-switch");
|
||||
} else {
|
||||
writer.write(".packed-switch ");
|
||||
IntegerRenderer.writeTo(writer, instruction.getFirstKey());
|
||||
writer.indent(4);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
for (LabelMethodItem label: labels) {
|
||||
label.writeTo(writer);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.deindent(4);
|
||||
writer.write(".end packed-switch");
|
||||
|
@ -29,7 +29,7 @@
|
||||
package org.jf.baksmali.Adaptors.Format;
|
||||
|
||||
import org.jf.baksmali.Adaptors.MethodDefinition;
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.Renderers.IntegerRenderer;
|
||||
import org.jf.dexlib.Code.Format.SparseSwitchDataPseudoInstruction;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
@ -70,24 +70,24 @@ public class SparseSwitchMethodItem extends InstructionMethodItem<SparseSwitchDa
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
if (dead) {
|
||||
writer.println("#.sparse-switch");
|
||||
writer.write("#.sparse-switch\n");
|
||||
for (SparseSwitchTarget target: targets) {
|
||||
IntegerRenderer.writeTo(writer, target.Key);
|
||||
writer.write(" -> ");
|
||||
target.Target.writeTo(writer);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.write("#.end sparse-switch");
|
||||
} else {
|
||||
writer.println(".sparse-switch");
|
||||
writer.write(".sparse-switch\n");
|
||||
writer.indent(4);
|
||||
for (SparseSwitchTarget target: targets) {
|
||||
IntegerRenderer.writeTo(writer, target.Key);
|
||||
writer.write(" -> ");
|
||||
target.Target.writeTo(writer);
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.deindent(4);
|
||||
writer.write(".end sparse-switch");
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors.Format;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.Code.Format.UnresolvedNullReference;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
|
||||
@ -43,7 +43,7 @@ public class UnresolvedNullReferenceMethodItem extends InstructionMethodItem<Unr
|
||||
this.isLastInstruction = isLastInstruction;
|
||||
}
|
||||
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
switch (instruction.OriginalInstruction.opcode)
|
||||
{
|
||||
case INVOKE_VIRTUAL_QUICK_RANGE:
|
||||
@ -56,22 +56,22 @@ public class UnresolvedNullReferenceMethodItem extends InstructionMethodItem<Unr
|
||||
}
|
||||
}
|
||||
|
||||
private void writeInvokeRangeTo(IndentingPrintWriter writer) throws IOException {
|
||||
writer.println("#Replaced unresolvable optimized invoke-*-range-quick instruction");
|
||||
writer.println("#with a generic method call that will throw a NullPointerException");
|
||||
private void writeInvokeRangeTo(IndentingWriter writer) throws IOException {
|
||||
writer.write("#Replaced unresolvable optimized invoke-*-range-quick instruction\n");
|
||||
writer.write("#with a generic method call that will throw a NullPointerException\n");
|
||||
writer.write("invoke-virtual/range {");
|
||||
writeRegister(writer, instruction.ObjectRegisterNum);
|
||||
writer.write(" .. ");
|
||||
writeRegister(writer, instruction.ObjectRegisterNum);
|
||||
writer.write("}, Ljava/lang/Object;->hashCode()I");
|
||||
if (isLastInstruction) {
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
writer.write("goto/32 0");
|
||||
}
|
||||
}
|
||||
|
||||
private void writeThrowTo(IndentingPrintWriter writer) throws IOException {
|
||||
writer.println("#Replaced unresolvable optimized instruction with a throw");
|
||||
private void writeThrowTo(IndentingWriter writer) throws IOException {
|
||||
writer.write("#Replaced unresolvable optimized instruction with a throw\n");
|
||||
writer.write("throw ");
|
||||
writeRegister(writer, instruction.ObjectRegisterNum);
|
||||
}
|
||||
|
@ -28,9 +28,11 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.baksmali;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LabelMethodItem extends MethodItem {
|
||||
private final String labelPrefix;
|
||||
private int labelSequence;
|
||||
@ -77,7 +79,7 @@ public class LabelMethodItem extends MethodItem {
|
||||
}
|
||||
|
||||
|
||||
public boolean writeTo(IndentingPrintWriter writer) {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writer.write(':');
|
||||
writer.write(labelPrefix);
|
||||
if (baksmali.useSequentialLabels) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.Adaptors.Format.*;
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.Renderers.IntegerRenderer;
|
||||
import org.jf.baksmali.baksmali;
|
||||
import org.jf.dexlib.*;
|
||||
@ -45,7 +45,7 @@ import org.jf.dexlib.Util.SparseIntArray;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
git
|
||||
|
||||
public class MethodDefinition {
|
||||
private final ClassDataItem.EncodedMethod encodedMethod;
|
||||
private final MethodAnalyzer methodAnalyzer;
|
||||
@ -99,14 +99,15 @@ public class MethodDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
public void writeTo(IndentingPrintWriter writer, AnnotationSetItem annotationSet,
|
||||
public void writeTo(IndentingWriter writer, AnnotationSetItem annotationSet,
|
||||
AnnotationSetRefList parameterAnnotations) throws IOException {
|
||||
final CodeItem codeItem = encodedMethod.codeItem;
|
||||
|
||||
writer.write(".method ");
|
||||
writeAccessFlags(writer, encodedMethod);
|
||||
writer.write(encodedMethod.method.getMethodName().getStringValue());
|
||||
writer.println(encodedMethod.method.getPrototype().getPrototypeString());
|
||||
writer.write(encodedMethod.method.getPrototype().getPrototypeString());
|
||||
writer.write('\n');
|
||||
|
||||
writer.indent(4);
|
||||
if (codeItem != null) {
|
||||
@ -115,13 +116,14 @@ public class MethodDefinition {
|
||||
} else {
|
||||
writer.write(".registers ");
|
||||
}
|
||||
writer.println(getRegisterCount(encodedMethod));
|
||||
writer.printIntAsDec(getRegisterCount(encodedMethod));
|
||||
writer.write('\n');
|
||||
writeParameters(writer, codeItem, parameterAnnotations);
|
||||
if (annotationSet != null) {
|
||||
AnnotationFormatter.writeTo(writer, annotationSet);
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
|
||||
for (MethodItem methodItem: getMethodItems()) {
|
||||
if (methodItem.writeTo(writer)) {
|
||||
@ -134,7 +136,7 @@ public class MethodDefinition {
|
||||
}
|
||||
}
|
||||
writer.deindent(4);
|
||||
writer.println(".end method");
|
||||
writer.write(".end method\n");
|
||||
}
|
||||
|
||||
private static int getRegisterCount(ClassDataItem.EncodedMethod encodedMethod)
|
||||
@ -150,14 +152,15 @@ public class MethodDefinition {
|
||||
return totalRegisters;
|
||||
}
|
||||
|
||||
private static void writeAccessFlags(IndentingPrintWriter writer, ClassDataItem.EncodedMethod encodedMethod) {
|
||||
private static void writeAccessFlags(IndentingWriter writer, ClassDataItem.EncodedMethod encodedMethod)
|
||||
throws IOException {
|
||||
for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForMethod(encodedMethod.accessFlags)) {
|
||||
writer.write(accessFlag.toString());
|
||||
writer.write(' ');
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeParameters(IndentingPrintWriter writer, CodeItem codeItem,
|
||||
private static void writeParameters(IndentingWriter writer, CodeItem codeItem,
|
||||
AnnotationSetRefList parameterAnnotations) throws IOException {
|
||||
DebugInfoItem debugInfoItem = null;
|
||||
if (baksmali.outputDebugInfo && codeItem != null) {
|
||||
@ -205,13 +208,13 @@ public class MethodDefinition {
|
||||
writer.write('"');
|
||||
}
|
||||
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
if (annotationSet != null) {
|
||||
writer.indent(4);
|
||||
AnnotationFormatter.writeTo(writer, annotationSet);
|
||||
writer.deindent(4);
|
||||
|
||||
writer.println(".end parameter");
|
||||
writer.write(".end parameter\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -362,7 +365,7 @@ public class MethodDefinition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writer.write("#@");
|
||||
IntegerRenderer.writeUnsignedTo(writer, codeAddress);
|
||||
return true;
|
||||
@ -483,7 +486,7 @@ public class MethodDefinition {
|
||||
final StringIdItem name, final TypeIdItem type) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -1) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeStartLocal(writer, codeItem, registerNum, name, type, null);
|
||||
return true;
|
||||
}
|
||||
@ -496,7 +499,7 @@ public class MethodDefinition {
|
||||
final TypeIdItem type, final StringIdItem signature) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -1) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeStartLocal(writer, codeItem, registerNum, name, type, signature);
|
||||
return true;
|
||||
}
|
||||
@ -509,7 +512,7 @@ public class MethodDefinition {
|
||||
final StringIdItem signature) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -1) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeEndLocal(writer, codeItem, registerNum, name, type, signature);
|
||||
return true;
|
||||
}
|
||||
@ -522,7 +525,7 @@ public class MethodDefinition {
|
||||
final StringIdItem signature) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -1) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeRestartLocal(writer, codeItem, registerNum, name, type, signature);
|
||||
return true;
|
||||
}
|
||||
@ -533,7 +536,7 @@ public class MethodDefinition {
|
||||
public void ProcessSetPrologueEnd(int codeAddress) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -4) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeEndPrologue(writer);
|
||||
return true;
|
||||
}
|
||||
@ -544,7 +547,7 @@ public class MethodDefinition {
|
||||
public void ProcessSetEpilogueBegin(int codeAddress) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -4) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeBeginEpilogue(writer);
|
||||
return true;
|
||||
}
|
||||
@ -555,7 +558,7 @@ public class MethodDefinition {
|
||||
public void ProcessSetFile(int codeAddress, int length, final StringIdItem name) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -3) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeSetFile(writer, name.getStringValue());
|
||||
return true;
|
||||
}
|
||||
@ -566,7 +569,7 @@ public class MethodDefinition {
|
||||
public void ProcessLineEmit(int codeAddress, final int line) {
|
||||
methodItems.add(new DebugMethodItem(codeAddress, -2) {
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
writeLine(writer, line);
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -55,5 +55,5 @@ public abstract class MethodItem implements Comparable<MethodItem> {
|
||||
return result;
|
||||
}
|
||||
|
||||
public abstract boolean writeTo(IndentingPrintWriter writer) throws IOException;
|
||||
public abstract boolean writeTo(IndentingWriter writer) throws IOException;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.baksmali;
|
||||
import org.jf.baksmali.main;
|
||||
import org.jf.dexlib.ClassDataItem;
|
||||
@ -56,7 +56,7 @@ public class PostInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
int registerInfo = baksmali.registerInfo;
|
||||
int registerCount = analyzedInstruction.getRegisterCount();
|
||||
BitSet registers = new BitSet(registerCount);
|
||||
@ -83,7 +83,7 @@ public class PostInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean writeRegisterInfo(IndentingPrintWriter writer, BitSet registers) throws IOException {
|
||||
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers) throws IOException {
|
||||
ClassDataItem.EncodedMethod encodedMethod = methodAnalyzer.getMethod();
|
||||
|
||||
int registerNum = registers.nextSetBit(0);
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.baksmali.baksmali;
|
||||
import org.jf.baksmali.main;
|
||||
import org.jf.dexlib.ClassDataItem;
|
||||
@ -58,7 +58,7 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean writeTo(IndentingPrintWriter writer) throws IOException {
|
||||
public boolean writeTo(IndentingWriter writer) throws IOException {
|
||||
int registerInfo = baksmali.registerInfo;
|
||||
int registerCount = analyzedInstruction.getRegisterCount();
|
||||
BitSet registers = new BitSet(registerCount);
|
||||
@ -165,7 +165,7 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
registers.set(registerCount-parameterRegisterCount, registerCount);
|
||||
}
|
||||
|
||||
private boolean writeFullMergeRegs(IndentingPrintWriter writer, BitSet registers, int registerCount)
|
||||
private boolean writeFullMergeRegs(IndentingWriter writer, BitSet registers, int registerCount)
|
||||
throws IOException {
|
||||
if (analyzedInstruction.getPredecessorCount() <= 1) {
|
||||
return false;
|
||||
@ -196,7 +196,7 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
if (firstRegister) {
|
||||
firstRegister = false;
|
||||
} else {
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
|
||||
writer.write('#');
|
||||
@ -233,7 +233,7 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
return !firstRegister;
|
||||
}
|
||||
|
||||
private boolean writeRegisterInfo(IndentingPrintWriter writer, BitSet registers,
|
||||
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers,
|
||||
boolean addNewline) throws IOException {
|
||||
ClassDataItem.EncodedMethod encodedMethod = methodAnalyzer.getMethod();
|
||||
|
||||
@ -243,7 +243,7 @@ public class PreInstructionRegisterInfoMethodItem extends MethodItem {
|
||||
}
|
||||
|
||||
if (addNewline) {
|
||||
writer.println();
|
||||
writer.write('\n');
|
||||
}
|
||||
writer.write('#');
|
||||
for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
|
||||
|
@ -28,14 +28,14 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.*;
|
||||
import org.jf.dexlib.Util.Utf8Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ReferenceFormatter {
|
||||
public static void writeReference(IndentingPrintWriter writer, Item item) throws IOException {
|
||||
public static void writeReference(IndentingWriter writer, Item item) throws IOException {
|
||||
switch (item.getItemType()) {
|
||||
case TYPE_METHOD_ID_ITEM:
|
||||
writeMethodReference(writer, (MethodIdItem)item);
|
||||
@ -52,14 +52,14 @@ public class ReferenceFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeMethodReference(IndentingPrintWriter writer, MethodIdItem item) {
|
||||
public static void writeMethodReference(IndentingWriter writer, MethodIdItem item) throws IOException {
|
||||
writer.write(item.getContainingClass().getTypeDescriptor());
|
||||
writer.write("->");
|
||||
writer.write(item.getMethodName().getStringValue());
|
||||
writer.write(item.getPrototype().getPrototypeString());
|
||||
}
|
||||
|
||||
public static void writeFieldReference(IndentingPrintWriter writer, FieldIdItem item) {
|
||||
public static void writeFieldReference(IndentingWriter writer, FieldIdItem item) throws IOException {
|
||||
writer.write(item.getContainingClass().getTypeDescriptor());
|
||||
writer.write("->");
|
||||
writer.write(item.getFieldName().getStringValue());
|
||||
@ -67,13 +67,13 @@ public class ReferenceFormatter {
|
||||
writer.write(item.getFieldType().getTypeDescriptor());
|
||||
}
|
||||
|
||||
public static void writeStringReference(IndentingPrintWriter writer, StringIdItem item) throws IOException {
|
||||
public static void writeStringReference(IndentingWriter writer, StringIdItem item) throws IOException {
|
||||
writer.write('"');
|
||||
Utf8Utils.writeEscapedString(writer, item.getStringValue());
|
||||
writer.write('"');
|
||||
}
|
||||
|
||||
public static void writeTypeReference(IndentingPrintWriter writer, TypeIdItem item) {
|
||||
public static void writeTypeReference(IndentingWriter writer, TypeIdItem item) throws IOException {
|
||||
writer.write(item.getTypeDescriptor());
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,13 @@
|
||||
|
||||
package org.jf.baksmali.Adaptors;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
import org.jf.dexlib.Util.AccessFlags;
|
||||
import org.jf.baksmali.baksmali;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* This class contains the logic used for formatting registers
|
||||
*/
|
||||
@ -43,13 +45,13 @@ public class RegisterFormatter {
|
||||
* output the registers in the v<n> format. But if false, then it will check if *both* registers are parameter
|
||||
* registers, and if so, use the p<n> format for both. If only the last register is a parameter register, it will
|
||||
* use the v<n> format for both, otherwise it would be confusing to have something like {v20 .. p1}
|
||||
* @param writer the <code>IndentingPrintWriter</code> to write to
|
||||
* @param writer the <code>IndentingWriter</code> to write to
|
||||
* @param codeItem the <code>CodeItem</code> that the register is from
|
||||
* @param startRegister the first register in the range
|
||||
* @param lastRegister the last register in the range
|
||||
*/
|
||||
public static void writeRegisterRange(IndentingPrintWriter writer, CodeItem codeItem, int startRegister,
|
||||
int lastRegister) {
|
||||
public static void writeRegisterRange(IndentingWriter writer, CodeItem codeItem, int startRegister,
|
||||
int lastRegister) throws IOException {
|
||||
assert lastRegister >= startRegister;
|
||||
|
||||
if (!baksmali.noParameterRegisters) {
|
||||
@ -61,17 +63,17 @@ public class RegisterFormatter {
|
||||
|
||||
if (startRegister >= registerCount - parameterRegisterCount) {
|
||||
writer.write("{p");
|
||||
writer.print(startRegister - (registerCount - parameterRegisterCount));
|
||||
writer.printIntAsDec(startRegister - (registerCount - parameterRegisterCount));
|
||||
writer.write(" .. p");
|
||||
writer.print(lastRegister - (registerCount - parameterRegisterCount));
|
||||
writer.printIntAsDec(lastRegister - (registerCount - parameterRegisterCount));
|
||||
writer.write('}');
|
||||
return;
|
||||
}
|
||||
}
|
||||
writer.write("{v");
|
||||
writer.print(startRegister);
|
||||
writer.printIntAsDec(startRegister);
|
||||
writer.write(" .. v");
|
||||
writer.print(lastRegister);
|
||||
writer.printIntAsDec(lastRegister);
|
||||
writer.write('}');
|
||||
}
|
||||
|
||||
@ -80,22 +82,22 @@ public class RegisterFormatter {
|
||||
* output a register in the v<n> format. If false, then it determines if the register is a parameter register,
|
||||
* and if so, formats it in the p<n> format instead.
|
||||
*
|
||||
* @param writer the <code>IndentingPrintWriter</code> to write to
|
||||
* @param writer the <code>IndentingWriter</code> to write to
|
||||
* @param codeItem the <code>CodeItem</code> that the register is from
|
||||
* @param register the register number
|
||||
*/
|
||||
public static void writeTo(IndentingPrintWriter writer, CodeItem codeItem, int register) {
|
||||
public static void writeTo(IndentingWriter writer, CodeItem codeItem, int register) throws IOException {
|
||||
if (!baksmali.noParameterRegisters) {
|
||||
int parameterRegisterCount = codeItem.getParent().method.getPrototype().getParameterRegisterCount()
|
||||
+ (((codeItem.getParent().accessFlags & AccessFlags.STATIC.getValue())==0)?1:0);
|
||||
int registerCount = codeItem.getRegisterCount();
|
||||
if (register >= registerCount - parameterRegisterCount) {
|
||||
writer.write('p');
|
||||
writer.print((register - (registerCount - parameterRegisterCount)));
|
||||
writer.printIntAsDec((register - (registerCount - parameterRegisterCount)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
writer.write('v');
|
||||
writer.print(register);
|
||||
writer.printIntAsDec(register);
|
||||
}
|
||||
}
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* [The "BSD licence"]
|
||||
* Copyright (c) 2010 Ben Gruver
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.jf.baksmali;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class IndentingPrintWriter extends PrintWriter {
|
||||
private IndentingWriter writer;
|
||||
private final char[] buffer = new char[16];
|
||||
|
||||
public IndentingPrintWriter(IndentingWriter writer) {
|
||||
super(writer);
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
public IndentingPrintWriter(IndentingWriter writer, boolean autoFlush) {
|
||||
super(writer, autoFlush);
|
||||
}
|
||||
|
||||
public void indent(int indentAmount) {
|
||||
writer.indent(indentAmount);
|
||||
}
|
||||
|
||||
public void deindent(int indentAmount) {
|
||||
writer.deindent(indentAmount);
|
||||
}
|
||||
|
||||
public void printLongAsHex(long l) {
|
||||
//synchronized(lock) {
|
||||
int i=0;
|
||||
do {
|
||||
int digit = (int)(l & 15);
|
||||
if (digit < 10) {
|
||||
buffer[i++] = (char)(digit + '0');
|
||||
} else {
|
||||
buffer[i++] = (char)((digit - 10) + 'a');
|
||||
}
|
||||
|
||||
l >>>= 4;
|
||||
} while (l != 0);
|
||||
|
||||
while (i>0) {
|
||||
write(buffer[--i]);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
@ -33,6 +33,7 @@ import java.io.Writer;
|
||||
|
||||
public class IndentingWriter extends Writer {
|
||||
private final Writer writer;
|
||||
private final char[] buffer = new char[16];
|
||||
private int indentLevel = 0;
|
||||
private boolean beginningOfLine;
|
||||
|
||||
@ -145,4 +146,42 @@ public class IndentingWriter extends Writer {
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
public void printLongAsHex(long value) throws IOException {
|
||||
int bufferIndex = 0;
|
||||
do {
|
||||
int digit = (int)(value & 15);
|
||||
if (digit < 10) {
|
||||
buffer[bufferIndex++] = (char)(digit + '0');
|
||||
} else {
|
||||
buffer[bufferIndex++] = (char)((digit - 10) + 'a');
|
||||
}
|
||||
|
||||
value >>>= 4;
|
||||
} while (value != 0);
|
||||
|
||||
while (bufferIndex>0) {
|
||||
write(buffer[--bufferIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
public void printIntAsDec(int value) throws IOException {
|
||||
int bufferIndex = 0;
|
||||
boolean negative = value < 0;
|
||||
|
||||
do {
|
||||
int digit = value % 10;
|
||||
buffer[bufferIndex++] = (char)(digit + '0');
|
||||
|
||||
value = value / 10;
|
||||
} while (value != 0);
|
||||
|
||||
if (negative) {
|
||||
write('-');
|
||||
}
|
||||
|
||||
while (bufferIndex>0) {
|
||||
write(buffer[--bufferIndex]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,12 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class BooleanRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, boolean val) {
|
||||
public static void writeTo(IndentingWriter writer, boolean val) throws IOException {
|
||||
if (val) {
|
||||
writer.write("true");
|
||||
} else {
|
||||
|
@ -28,10 +28,12 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ByteRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, byte val) {
|
||||
public static void writeTo(IndentingWriter writer, byte val) throws IOException {
|
||||
if (val<0) {
|
||||
writer.write("-0x");
|
||||
writer.printLongAsHex(-val);
|
||||
@ -43,7 +45,7 @@ public class ByteRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeUnsignedTo(IndentingPrintWriter writer, byte val) {
|
||||
public static void writeUnsignedTo(IndentingWriter writer, byte val) throws IOException {
|
||||
writer.write("0x");
|
||||
writer.printLongAsHex(val & 0xFF);
|
||||
writer.write('t');
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
import org.jf.dexlib.Util.Utf8Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CharRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, char val) throws IOException {
|
||||
public static void writeTo(IndentingWriter writer, char val) throws IOException {
|
||||
writer.write('\'');
|
||||
Utf8Utils.writeEscapedChar(writer, val);
|
||||
writer.write('\'');
|
||||
|
@ -28,10 +28,12 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DoubleRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, double val) {
|
||||
writer.print(val);
|
||||
public static void writeTo(IndentingWriter writer, double val) throws IOException {
|
||||
writer.write(Double.toString(val));
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,13 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class FloatRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, float val) {
|
||||
writer.print(val);
|
||||
public static void writeTo(IndentingWriter writer, float val) throws IOException {
|
||||
writer.write(Float.toString(val));
|
||||
writer.write('f');
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,12 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class IntegerRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, int val) {
|
||||
public static void writeTo(IndentingWriter writer, int val) throws IOException {
|
||||
if (val<0) {
|
||||
writer.write("-0x");
|
||||
writer.printLongAsHex(-((long)val));
|
||||
@ -41,7 +43,7 @@ public class IntegerRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeUnsignedTo(IndentingPrintWriter writer, int val) {
|
||||
public static void writeUnsignedTo(IndentingWriter writer, int val) throws IOException {
|
||||
writer.write("0x");
|
||||
writer.printLongAsHex(val & 0xFFFFFFFF);
|
||||
}
|
||||
|
@ -28,10 +28,12 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LongRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, long val) {
|
||||
public static void writeTo(IndentingWriter writer, long val) throws IOException {
|
||||
if (val<0) {
|
||||
writer.write("-0x");
|
||||
writer.printLongAsHex(-val);
|
||||
@ -43,7 +45,7 @@ public class LongRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeSignedIntOrLongTo(IndentingPrintWriter writer, long val) {
|
||||
public static void writeSignedIntOrLongTo(IndentingWriter writer, long val) throws IOException {
|
||||
if (val<0) {
|
||||
writer.write("-0x");
|
||||
writer.printLongAsHex(-val);
|
||||
|
@ -28,10 +28,12 @@
|
||||
|
||||
package org.jf.baksmali.Renderers;
|
||||
|
||||
import org.jf.baksmali.IndentingPrintWriter;
|
||||
import org.jf.baksmali.IndentingWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ShortRenderer {
|
||||
public static void writeTo(IndentingPrintWriter writer, short val) {
|
||||
public static void writeTo(IndentingWriter writer, short val) throws IOException {
|
||||
if (val < 0) {
|
||||
writer.write("-0x");
|
||||
writer.printLongAsHex(-val);
|
||||
|
@ -29,11 +29,9 @@
|
||||
package org.jf.baksmali;
|
||||
|
||||
import org.jf.baksmali.Adaptors.ClassDefinition;
|
||||
import org.jf.baksmali.Renderers.*;
|
||||
import org.jf.dexlib.Code.Analysis.ClassPath;
|
||||
import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.ClassDefItem;
|
||||
import org.jf.dexlib.StringIdItem;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.regex.Matcher;
|
||||
@ -163,8 +161,8 @@ public class baksmali {
|
||||
|
||||
BufferedWriter bufWriter = new BufferedWriter(new FileWriter(smaliFile));
|
||||
|
||||
writer = new IndentingPrintWriter(new IndentingWriter(bufWriter));
|
||||
classDefinition.writeTo((IndentingPrintWriter)writer);
|
||||
writer = new IndentingWriter(bufWriter);
|
||||
classDefinition.writeTo((IndentingWriter)writer);
|
||||
} catch (Exception ex) {
|
||||
System.err.println("\n\nError occured while disassembling class " + classDescriptor.replace('/', '.') + " - skipping class");
|
||||
ex.printStackTrace();
|
||||
|
Loading…
x
Reference in New Issue
Block a user