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

The following examples show how to use org.jf.dexlib2.dexbacked.DexBackedDexFile#getString() . 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: StringIdItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) {
    try {
        String string = dexFile.getString(stringIndex);
        if (quote) {
            string = String.format("\"%s\"", StringUtils.escapeString(string));
        }
        return String.format("string_id_item[%d]: %s", stringIndex, string);
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    return String.format("string_id_item[%d]", stringIndex);
}
 
Example 2
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 3
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 4
Source File: StringIdItem.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) {
    try {
        String string = dexFile.getString(stringIndex);
        if (quote) {
            string = String.format("\"%s\"", StringUtils.escapeString(string));
        }
        return String.format("string_id_item[%d]: %s", stringIndex, string);
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    return String.format("string_id_item[%d]", stringIndex);
}
 
Example 5
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 6
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 7
Source File: StringIdItem.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) {
    try {
        String string = dexFile.getString(stringIndex);
        if (quote) {
            string = String.format("\"%s\"", StringUtils.escapeString(string));
        }
        return String.format("string_id_item[%d]: %s", stringIndex, string);
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    return String.format("string_id_item[%d]", stringIndex);
}
 
Example 8
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 9
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 10
Source File: StringIdItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int stringIndex, boolean quote) {
    try {
        String string = dexFile.getString(stringIndex);
        if (quote) {
            string = String.format("\"%s\"", StringUtils.escapeString(string));
        }
        return String.format("string_id_item[%d]: %s", stringIndex, string);
    } catch (Exception ex) {
        ex.printStackTrace(System.err);
    }
    return String.format("string_id_item[%d]", stringIndex);
}
 
Example 11
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 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);
}