private void printTypeLists() throws IOException { if (tableOfContents.typeLists.off == -1) { System.out.println("No type lists"); return; } 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(" " + dex.typeNames().get((int) in.readShort())); } if (size % 2 == 1) { in.readShort(); // retain alignment } System.out.println(); } }
private void printTypeLists() throws IOException { if (tableOfContents.typeLists.off == -1) { System.out.println("No type lists"); return; } 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(" " + dex.typeNames().get((int) in.readShort())); } if (size % 2 == 1) { in.readShort(); // retain alignment } System.out.println(); } }
private void printTypeLists() throws IOException { if (tableOfContents.typeLists.off == -1) { System.out.println("No type lists"); return; } 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(" " + dex.typeNames().get((int) in.readShort())); } if (size % 2 == 1) { in.readShort(); // retain alignment } System.out.println(); } }
private Code readCode() { int registersSize = readUnsignedShort(); int insSize = readUnsignedShort(); int outsSize = readUnsignedShort(); int triesSize = readUnsignedShort(); int debugInfoOffset = readInt(); int instructionsSize = readInt(); short[] instructions = readShortArray(instructionsSize); Try[] tries; CatchHandler[] catchHandlers; if (triesSize > 0) { if (instructions.length % 2 == 1) { readShort(); // padding } /* * We can't read the tries until we've read the catch handlers. * Unfortunately they're in the opposite order in the dex file * so we need to read them out-of-order. */ Section triesSection = open(data.position()); skip(triesSize * SizeOf.TRY_ITEM); catchHandlers = readCatchHandlers(); tries = triesSection.readTries(triesSize, catchHandlers); } else { tries = new Try[0]; catchHandlers = new CatchHandler[0]; } return new Code(registersSize, insSize, outsSize, debugInfoOffset, instructions, tries, catchHandlers); }
private Code readCode() { int registersSize = readUnsignedShort(); int insSize = readUnsignedShort(); int outsSize = readUnsignedShort(); int triesSize = readUnsignedShort(); int debugInfoOffset = readInt(); int instructionsSize = readInt(); short[] instructions = readShortArray(instructionsSize); Try[] tries; CatchHandler[] catchHandlers; if (triesSize > 0) { if (instructions.length % 2 == 1) { readShort(); // padding } /* * We can't read the tries until we've read the catch handlers. * Unfortunately they're in the opposite order in the dex file * so we need to read them out-of-order. */ Section triesSection = open(data.position()); skip(triesSize * SizeOf.TRY_ITEM); catchHandlers = readCatchHandlers(); tries = triesSection.readTries(triesSize, catchHandlers); } else { tries = new Try[0]; catchHandlers = new CatchHandler[0]; } return new Code(registersSize, insSize, outsSize, debugInfoOffset, instructions, tries, catchHandlers); }
private Code readCode() { int registersSize = readUnsignedShort(); int insSize = readUnsignedShort(); int outsSize = readUnsignedShort(); int triesSize = readUnsignedShort(); int debugInfoOffset = readInt(); int instructionsSize = readInt(); short[] instructions = readShortArray(instructionsSize); Try[] tries; CatchHandler[] catchHandlers; if (triesSize > 0) { if (instructions.length % 2 == 1) { readShort(); // padding } /* * We can't read the tries until we've read the catch handlers. * Unfortunately they're in the opposite order in the dex file * so we need to read them out-of-order. */ Section triesSection = open(data.position()); skip(triesSize * SizeOf.TRY_ITEM); catchHandlers = readCatchHandlers(); tries = triesSection.readTries(triesSize, catchHandlers); } else { tries = new Try[0]; catchHandlers = new CatchHandler[0]; } return new Code(registersSize, insSize, outsSize, debugInfoOffset, instructions, tries, catchHandlers); }
private void readMap(Dex.Section in) throws IOException { int mapSize = in.readInt(); Section previous = null; for (int i = 0; i < mapSize; i++) { short type = in.readShort(); in.readShort(); // unused Section section = getSection(type); int size = in.readInt(); int offset = in.readInt(); if ((section.size != 0 && section.size != size) || (section.off != -1 && section.off != offset)) { throw new DexException("Unexpected map value for 0x" + Integer.toHexString(type)); } section.size = size; section.off = offset; if (previous != null && previous.off > section.off) { throw new DexException("Map is unsorted at " + previous + ", " + section); } previous = section; } Arrays.sort(sections); }
private void readMap(Dex.Section in) throws IOException { int mapSize = in.readInt(); Section previous = null; for (int i = 0; i < mapSize; i++) { short type = in.readShort(); in.readShort(); // unused Section section = getSection(type); int size = in.readInt(); int offset = in.readInt(); if ((section.size != 0 && section.size != size) || (section.off != -1 && section.off != offset)) { throw new DexException("Unexpected map value for 0x" + Integer.toHexString(type)); } section.size = size; section.off = offset; if (previous != null && previous.off > section.off) { throw new DexException("Map is unsorted at " + previous + ", " + section); } previous = section; } Arrays.sort(sections); }
private void readMap(Dex.Section in) throws IOException { int mapSize = in.readInt(); Section previous = null; for (int i = 0; i < mapSize; i++) { short type = in.readShort(); in.readShort(); // unused Section section = getSection(type); int size = in.readInt(); int offset = in.readInt(); if ((section.size != 0 && section.size != size) || (section.off != -1 && section.off != offset)) { throw new DexException("Unexpected map value for 0x" + Integer.toHexString(type)); } section.size = size; section.off = offset; if (previous != null && previous.off > section.off) { throw new DexException("Map is unsorted at " + previous + ", " + section); } previous = section; } Arrays.sort(sections); }
public int readUnsignedShort() { return readShort() & 0xffff; }
public int readUnsignedShort() { return readShort() & 0xffff; }
public int readUnsignedShort() { return readShort() & 0xffff; }
public short[] readShortArray(int length) { if (length == 0) { return EMPTY_SHORT_ARRAY; } short[] result = new short[length]; for (int i = 0; i < length; i++) { result[i] = readShort(); } return result; }
public short[] readShortArray(int length) { if (length == 0) { return EMPTY_SHORT_ARRAY; } short[] result = new short[length]; for (int i = 0; i < length; i++) { result[i] = readShort(); } return result; }
public short[] readShortArray(int length) { if (length == 0) { return EMPTY_SHORT_ARRAY; } short[] result = new short[length]; for (int i = 0; i < length; i++) { result[i] = readShort(); } return result; }