diff options
Diffstat (limited to 'dx/src/com/android/dx/io/DexIndexPrinter.java')
-rw-r--r-- | dx/src/com/android/dx/io/DexIndexPrinter.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/dx/src/com/android/dx/io/DexIndexPrinter.java b/dx/src/com/android/dx/io/DexIndexPrinter.java index 85c201512..2b89d44e7 100644 --- a/dx/src/com/android/dx/io/DexIndexPrinter.java +++ b/dx/src/com/android/dx/io/DexIndexPrinter.java @@ -16,7 +16,12 @@ package com.android.dx.io; -import com.android.dx.dex.TableOfContents; +import com.android.dex.ClassDef; +import com.android.dex.Dex; +import com.android.dex.FieldId; +import com.android.dex.MethodId; +import com.android.dex.ProtoId; +import com.android.dex.TableOfContents; import java.io.File; import java.io.IOException; @@ -24,12 +29,12 @@ import java.io.IOException; * Executable that prints all indices of a dex file. */ public final class DexIndexPrinter { - private final DexBuffer dexBuffer; + private final Dex dex; private final TableOfContents tableOfContents; public DexIndexPrinter(File file) throws IOException { - this.dexBuffer = new DexBuffer(file); - this.tableOfContents = dexBuffer.getTableOfContents(); + this.dex = new Dex(file); + this.tableOfContents = dex.getTableOfContents(); } private void printMap() { @@ -45,7 +50,7 @@ public final class DexIndexPrinter { private void printStrings() throws IOException { int index = 0; - for (String string : dexBuffer.strings()) { + for (String string : dex.strings()) { System.out.println("string " + index + ": " + string); index++; } @@ -53,15 +58,15 @@ public final class DexIndexPrinter { private void printTypeIds() throws IOException { int index = 0; - for (Integer type : dexBuffer.typeIds()) { - System.out.println("type " + index + ": " + dexBuffer.strings().get(type)); + for (Integer type : dex.typeIds()) { + System.out.println("type " + index + ": " + dex.strings().get(type)); index++; } } private void printProtoIds() throws IOException { int index = 0; - for (ProtoId protoId : dexBuffer.protoIds()) { + for (ProtoId protoId : dex.protoIds()) { System.out.println("proto " + index + ": " + protoId); index++; } @@ -69,7 +74,7 @@ public final class DexIndexPrinter { private void printFieldIds() throws IOException { int index = 0; - for (FieldId fieldId : dexBuffer.fieldIds()) { + for (FieldId fieldId : dex.fieldIds()) { System.out.println("field " + index + ": " + fieldId); index++; } @@ -77,7 +82,7 @@ public final class DexIndexPrinter { private void printMethodIds() throws IOException { int index = 0; - for (MethodId methodId : dexBuffer.methodIds()) { + for (MethodId methodId : dex.methodIds()) { System.out.println("methodId " + index + ": " + methodId); index++; } @@ -88,12 +93,12 @@ public final class DexIndexPrinter { System.out.println("No type lists"); return; } - DexBuffer.Section in = dexBuffer.open(tableOfContents.typeLists.off); + Dex.Section in = dex.open(tableOfContents.typeLists.off); for (int i = 0; i < tableOfContents.typeLists.size; i++) { int size = in.readInt(); System.out.print("Type list i=" + i + ", size=" + size + ", elements="); for (int t = 0; t < size; t++) { - System.out.print(" " + dexBuffer.typeNames().get((int) in.readShort())); + System.out.print(" " + dex.typeNames().get((int) in.readShort())); } if (size % 2 == 1) { in.readShort(); // retain alignment @@ -104,7 +109,7 @@ public final class DexIndexPrinter { private void printClassDefs() { int index = 0; - for (ClassDef classDef : dexBuffer.classDefs()) { + for (ClassDef classDef : dex.classDefs()) { System.out.println("class def " + index + ": " + classDef); index++; } |