/** * Reads a string index. String indicies are offset by 1, and a 0 value in the stream (-1 as returned by this * method) means "null" * * @return index into file's string ids table, -1 means null */ private static int readStringIndex(ByteBuffer bs) { int offsetIndex = readULeb128i(bs); return offsetIndex - 1; }
private Object[] read_encoded_array(ByteBuffer in) { int size = readULeb128i(in); Object[] constant = new Object[size]; for (int i = 0; i < size; i++) { constant[i] = readEncodedValue(in); } return constant; }
private String getString(int id) { if (id == -1) { return null; } int offset = stringIdIn.getInt(id * 4); stringDataIn.position(offset); int length = readULeb128i(stringDataIn); try { StringBuilder buff = new StringBuilder((int) (length * 1.5)); return Mutf8.decode(stringDataIn, buff); } catch (UTFDataFormatException e) { throw new DexException(e, "fail to load string %d@%08x", id, offset); } }
private DexAnnotationNode read_encoded_annotation(ByteBuffer in) { int type_idx = readULeb128i(in); int size = readULeb128i(in); String _typeString = getType(type_idx); DexAnnotationNode ann = new DexAnnotationNode(_typeString, Visibility.RUNTIME); for (int i = 0; i < size; i++) { int name_idx = readULeb128i(in); String nameString = getString(name_idx); Object value = readEncodedValue(in); ann.items.add(new DexAnnotationNode.Item(nameString, value)); } return ann; }
String types[] = new String[handlerCount]; for (int k = 0; k < listSize; k++) { int type_id = (int) readULeb128i(handlerIn); int handler = (int) readULeb128i(handlerIn); order(labelsMap, handler); handlers.add(handler); int handler = (int) readULeb128i(handlerIn); order(labelsMap, handler); handlers.add(handler);
in.position(class_data_off); int static_fields = (int) readULeb128i(in); int instance_fields = (int) readULeb128i(in); int direct_methods = (int) readULeb128i(in); int virtual_methods = (int) readULeb128i(in);
private int acceptField(ByteBuffer in, int lastIndex, DexClassVisitor dcv, Map<Integer, Integer> fieldAnnotationPositions, Object value, int config) { int diff = (int) readULeb128i(in); int field_access_flags = (int) readULeb128i(in); int field_id = lastIndex + diff; Field field = getField(field_id); // ////////////////////////////////////////////////////////////// DexFieldVisitor dfv = dcv.visitField(field_access_flags, field, value); if (dfv != null) { if ((config & SKIP_ANNOTATION) == 0) { Integer annotation_offset = fieldAnnotationPositions.get(field_id); if (annotation_offset != null) { try { read_annotation_set_item(annotation_offset, dfv); } catch (Exception e) { throw new DexException(e, "while accept annotation in field:%s.", field.toString()); } } } dfv.visitEnd(); } // ////////////////////////////////////////////////////////////// return field_id; }
in.position(offset); int address = 0; int line = readULeb128i(in); int szParams = readULeb128i(in); LocalEntry lastEntryForReg[] = new LocalEntry[regSize]; int argsSize = 0; int reg = readULeb128i(in); int nameIdx = readStringIndex(in); int typeIdx = readStringIndex(in); int reg = readULeb128i(in); int nameIdx = readStringIndex(in); int typeIdx = readStringIndex(in); int reg = readULeb128i(in); LocalEntry le = lastEntryForReg[reg]; if (le == null) { int reg = readULeb128i(in); LocalEntry le = lastEntryForReg[reg]; if (le == null) { address += readULeb128i(in); break;
private int acceptMethod(ByteBuffer in, int lastIndex, DexClassVisitor cv, Map<Integer, Integer> methodAnnos, Map<Integer, Integer> parameterAnnos, int config, boolean firstMethod) { int offset = in.position(); int diff = (int) readULeb128i(in); int method_access_flags = (int) readULeb128i(in); int code_off = (int) readULeb128i(in); int method_id = lastIndex + diff; Method method = getMethod(method_id);
/** * Reads a string index. String indicies are offset by 1, and a 0 value in the stream (-1 as returned by this * method) means "null" * * @return index into file's string ids table, -1 means null */ private static int readStringIndex(ByteBuffer bs) { int offsetIndex = readULeb128i(bs); return offsetIndex - 1; }
private Object[] read_encoded_array(ByteBuffer in) { int size = readULeb128i(in); Object[] constant = new Object[size]; for (int i = 0; i < size; i++) { constant[i] = readEncodedValue(in); } return constant; }
private DexAnnotationNode read_encoded_annotation(ByteBuffer in) { int type_idx = readULeb128i(in); int size = readULeb128i(in); String _typeString = getType(type_idx); DexAnnotationNode ann = new DexAnnotationNode(_typeString, Visibility.RUNTIME); for (int i = 0; i < size; i++) { int name_idx = readULeb128i(in); String nameString = getString(name_idx); Object value = readEncodedValue(in); ann.items.add(new DexAnnotationNode.Item(nameString, value)); } return ann; }
private String getString(int id) { if (id == -1) { return null; } int offset = stringIdIn.getInt(id * 4); stringDataIn.position(offset); int length = readULeb128i(stringDataIn); try { StringBuilder buff = new StringBuilder((int) (length * 1.5)); return Mutf8.decode(stringDataIn, buff); } catch (UTFDataFormatException e) { throw new DexException(e, "fail to load string %d@%08x", id, offset); } }
String types[] = new String[handlerCount]; for (int k = 0; k < listSize; k++) { int type_id = (int) readULeb128i(handlerIn); int handler = (int) readULeb128i(handlerIn); order(labelsMap, handler); handlers.add(handler); int handler = (int) readULeb128i(handlerIn); order(labelsMap, handler); handlers.add(handler);
private int acceptField(ByteBuffer in, int lastIndex, DexClassVisitor dcv, Map<Integer, Integer> fieldAnnotationPositions, Object value, int config) { int diff = (int) readULeb128i(in); int field_access_flags = (int) readULeb128i(in); int field_id = lastIndex + diff; Field field = getField(field_id); // ////////////////////////////////////////////////////////////// DexFieldVisitor dfv = dcv.visitField(field_access_flags, field, value); if (dfv != null) { if ((config & SKIP_ANNOTATION) == 0) { Integer annotation_offset = fieldAnnotationPositions.get(field_id); if (annotation_offset != null) { try { read_annotation_set_item(annotation_offset, dfv); } catch (Exception e) { throw new DexException(e, "while accept annotation in field:%s.", field.toString()); } } } dfv.visitEnd(); } // ////////////////////////////////////////////////////////////// return field_id; }
in.position(class_data_off); int static_fields = (int) readULeb128i(in); int instance_fields = (int) readULeb128i(in); int direct_methods = (int) readULeb128i(in); int virtual_methods = (int) readULeb128i(in);
private int acceptMethod(ByteBuffer in, int lastIndex, DexClassVisitor cv, Map<Integer, Integer> methodAnnos, Map<Integer, Integer> parameterAnnos, int config, boolean firstMethod) { int offset = in.position(); int diff = (int) readULeb128i(in); int method_access_flags = (int) readULeb128i(in); int code_off = (int) readULeb128i(in); int method_id = lastIndex + diff; Method method = getMethod(method_id);
in.position(offset); int address = 0; int line = readULeb128i(in); int szParams = readULeb128i(in); LocalEntry lastEntryForReg[] = new LocalEntry[regSize]; int argsSize = 0; int reg = readULeb128i(in); int nameIdx = readStringIndex(in); int typeIdx = readStringIndex(in); int reg = readULeb128i(in); int nameIdx = readStringIndex(in); int typeIdx = readStringIndex(in); int reg = readULeb128i(in); LocalEntry le = lastEntryForReg[reg]; if (le == null) { int reg = readULeb128i(in); LocalEntry le = lastEntryForReg[reg]; if (le == null) { address += readULeb128i(in); break;