Java Code Examples for org.jf.dexlib2.dexbacked.DexBackedDexFile#readUshort()

The following examples show how to use org.jf.dexlib2.dexbacked.DexBackedDexFile#readUshort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeListItem.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int typeListOffset) {
    if (typeListOffset == 0) {
        return "";
    }

    StringBuilder sb = new StringBuilder();

    int size = dexFile.readSmallUint(typeListOffset);
    for (int i=0; i<size; i++) {
        int typeIndex = dexFile.readUshort(typeListOffset + 4 + i*2);
        String type = dexFile.getType(typeIndex);
        sb.append(type);
    }
    return sb.toString();
}
 
Example 2
Source File: TypeListItem.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int typeListOffset) {
    if (typeListOffset == 0) {
        return "";
    }

    StringBuilder sb = new StringBuilder();

    int size = dexFile.readSmallUint(typeListOffset);
    for (int i=0; i<size; i++) {
        int typeIndex = dexFile.readUshort(typeListOffset + 4 + i*2);
        String type = dexFile.getType(typeIndex);
        sb.append(type);
    }
    return sb.toString();
}
 
Example 3
Source File: TypeListItem.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int typeListOffset) {
    if (typeListOffset == 0) {
        return "";
    }

    StringBuilder sb = new StringBuilder();

    int size = dexFile.readSmallUint(typeListOffset);
    for (int i=0; i<size; i++) {
        int typeIndex = dexFile.readUshort(typeListOffset + 4 + i*2);
        String type = dexFile.getType(typeIndex);
        sb.append(type);
    }
    return sb.toString();
}
 
Example 4
Source File: MethodIdItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int methodIndex) {
    int methodOffset = dexFile.getMethodIdItemOffset(methodIndex);
    int classIndex = dexFile.readUshort(methodOffset + CLASS_OFFSET);
    String classType = dexFile.getType(classIndex);

    int protoIndex = dexFile.readUshort(methodOffset + PROTO_OFFSET);
    String protoString = ProtoIdItem.asString(dexFile, protoIndex);

    int nameIndex = dexFile.readSmallUint(methodOffset + NAME_OFFSET);
    String methodName = dexFile.getString(nameIndex);

    return String.format("%s->%s%s", classType, methodName, protoString);
}
 
Example 5
Source File: FieldIdItem.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int fieldIndex) {
    int fieldOffset = dexFile.getFieldIdItemOffset(fieldIndex);
    int classIndex = dexFile.readUshort(fieldOffset + CLASS_OFFSET);
    String classType = dexFile.getType(classIndex);

    int typeIndex = dexFile.readUshort(fieldOffset + TYPE_OFFSET);
    String fieldType = dexFile.getType(typeIndex);

    int nameIndex = dexFile.readSmallUint(fieldOffset + NAME_OFFSET);
    String fieldName = dexFile.getString(nameIndex);

    return String.format("%s->%s:%s", classType, fieldName, fieldType);
}
 
Example 6
Source File: MethodIdItem.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int methodIndex) {
    int methodOffset = dexFile.getMethodIdItemOffset(methodIndex);
    int classIndex = dexFile.readUshort(methodOffset + CLASS_OFFSET);
    String classType = dexFile.getType(classIndex);

    int protoIndex = dexFile.readUshort(methodOffset + PROTO_OFFSET);
    String protoString = ProtoIdItem.asString(dexFile, protoIndex);

    int nameIndex = dexFile.readSmallUint(methodOffset + NAME_OFFSET);
    String methodName = dexFile.getString(nameIndex);

    return String.format("%s->%s%s", classType, methodName, protoString);
}
 
Example 7
Source File: DexBackedArrayPayload.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public DexBackedArrayPayload(@Nonnull DexBackedDexFile dexFile,
                             int instructionStart) {
    super(dexFile, OPCODE, instructionStart);

    elementWidth = dexFile.readUshort(instructionStart + ELEMENT_WIDTH_OFFSET);
    elementCount = dexFile.readSmallUint(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 8
Source File: FieldIdItem.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int fieldIndex) {
    int fieldOffset = dexFile.getFieldIdItemOffset(fieldIndex);
    int classIndex = dexFile.readUshort(fieldOffset + CLASS_OFFSET);
    String classType = dexFile.getType(classIndex);

    int typeIndex = dexFile.readUshort(fieldOffset + TYPE_OFFSET);
    String fieldType = dexFile.getType(typeIndex);

    int nameIndex = dexFile.readSmallUint(fieldOffset + NAME_OFFSET);
    String fieldName = dexFile.getString(nameIndex);

    return String.format("%s->%s:%s", classType, fieldName, fieldType);
}
 
Example 9
Source File: MethodIdItem.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int methodIndex) {
    int methodOffset = dexFile.getMethodIdItemOffset(methodIndex);
    int classIndex = dexFile.readUshort(methodOffset + CLASS_OFFSET);
    String classType = dexFile.getType(classIndex);

    int protoIndex = dexFile.readUshort(methodOffset + PROTO_OFFSET);
    String protoString = ProtoIdItem.asString(dexFile, protoIndex);

    int nameIndex = dexFile.readSmallUint(methodOffset + NAME_OFFSET);
    String methodName = dexFile.getString(nameIndex);

    return String.format("%s->%s%s", classType, methodName, protoString);
}
 
Example 10
Source File: DexBackedArrayPayload.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public DexBackedArrayPayload(@Nonnull DexBackedDexFile dexFile,
                             int instructionStart) {
    super(dexFile, OPCODE, instructionStart);

    elementWidth = dexFile.readUshort(instructionStart + ELEMENT_WIDTH_OFFSET);
    elementCount = dexFile.readSmallUint(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 11
Source File: FieldIdItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int fieldIndex) {
    int fieldOffset = dexFile.getFieldIdItemOffset(fieldIndex);
    int classIndex = dexFile.readUshort(fieldOffset + CLASS_OFFSET);
    String classType = dexFile.getType(classIndex);

    int typeIndex = dexFile.readUshort(fieldOffset + TYPE_OFFSET);
    String fieldType = dexFile.getType(typeIndex);

    int nameIndex = dexFile.readSmallUint(fieldOffset + NAME_OFFSET);
    String fieldName = dexFile.getString(nameIndex);

    return String.format("%s->%s:%s", classType, fieldName, fieldType);
}
 
Example 12
Source File: FieldIdItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static String asString(@Nonnull DexBackedDexFile dexFile, int fieldIndex) {
    int fieldOffset = dexFile.getFieldIdItemOffset(fieldIndex);
    int classIndex = dexFile.readUshort(fieldOffset + CLASS_OFFSET);
    String classType = dexFile.getType(classIndex);

    int typeIndex = dexFile.readUshort(fieldOffset + TYPE_OFFSET);
    String fieldType = dexFile.getType(typeIndex);

    int nameIndex = dexFile.readSmallUint(fieldOffset + NAME_OFFSET);
    String fieldName = dexFile.getString(nameIndex);

    return String.format("%s->%s:%s", classType, fieldName, fieldType);
}
 
Example 13
Source File: DexBackedArrayPayload.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public DexBackedArrayPayload(@Nonnull DexBackedDexFile dexFile,
                             int instructionStart) {
    super(dexFile, OPCODE, instructionStart);

    elementWidth = dexFile.readUshort(instructionStart + ELEMENT_WIDTH_OFFSET);
    elementCount = dexFile.readSmallUint(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 14
Source File: DexBackedSparseSwitchPayload.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public DexBackedSparseSwitchPayload(@Nonnull DexBackedDexFile dexFile,
                                    int instructionStart) {
    super(dexFile, Opcode.SPARSE_SWITCH_PAYLOAD, instructionStart);

    elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 15
Source File: DexBackedPackedSwitchPayload.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
public DexBackedPackedSwitchPayload(@Nonnull DexBackedDexFile dexFile,
                                    int instructionStart) {
    super(dexFile, Opcode.PACKED_SWITCH_PAYLOAD, instructionStart);

    elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 16
Source File: DexBackedPackedSwitchPayload.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public DexBackedPackedSwitchPayload(@Nonnull DexBackedDexFile dexFile,
                                    int instructionStart) {
    super(dexFile, Opcode.PACKED_SWITCH_PAYLOAD, instructionStart);

    elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 17
Source File: DexBackedSparseSwitchPayload.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
public DexBackedSparseSwitchPayload(@Nonnull DexBackedDexFile dexFile,
                                    int instructionStart) {
    super(dexFile, Opcode.SPARSE_SWITCH_PAYLOAD, instructionStart);

    elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 18
Source File: DexBackedPackedSwitchPayload.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public DexBackedPackedSwitchPayload(@Nonnull DexBackedDexFile dexFile,
                                    int instructionStart) {
    super(dexFile, Opcode.PACKED_SWITCH_PAYLOAD, instructionStart);

    elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 19
Source File: DexBackedPackedSwitchPayload.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public DexBackedPackedSwitchPayload(@Nonnull DexBackedDexFile dexFile,
                                    int instructionStart) {
    super(dexFile, Opcode.PACKED_SWITCH_PAYLOAD, instructionStart);

    elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET);
}
 
Example 20
Source File: DexBackedSparseSwitchPayload.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
public DexBackedSparseSwitchPayload(@Nonnull DexBackedDexFile dexFile,
                                    int instructionStart) {
    super(dexFile, Opcode.SPARSE_SWITCH_PAYLOAD, instructionStart);

    elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET);
}