Search in sources :

Example 1 with EncodedValueReader

use of com.taobao.android.dex.EncodedValueReader in project atlas by alibaba.

the class Grep method grep.

/**
     * Prints usages to out. Returns the number of matches found.
     */
public int grep() {
    for (ClassDef classDef : dex.classDefs()) {
        currentClass = classDef;
        currentMethod = null;
        if (classDef.getClassDataOffset() == 0) {
            continue;
        }
        ClassData classData = dex.readClassData(classDef);
        // find the strings in encoded constants
        int staticValuesOffset = classDef.getStaticValuesOffset();
        if (staticValuesOffset != 0) {
            readArray(new EncodedValueReader(dex.open(staticValuesOffset)));
        }
        // find the strings in method bodies
        for (ClassData.Method method : classData.allMethods()) {
            currentMethod = method;
            if (method.getCodeOffset() != 0) {
                codeReader.visitAll(dex.readCode(method).getInstructions());
            }
        }
    }
    currentClass = null;
    currentMethod = null;
    return count;
}
Also used : ClassDef(com.taobao.android.dex.ClassDef) EncodedValueReader(com.taobao.android.dex.EncodedValueReader) ClassData(com.taobao.android.dex.ClassData)

Example 2 with EncodedValueReader

use of com.taobao.android.dex.EncodedValueReader in project atlas by alibaba.

the class IndexMap method adjustEncodedArray.

public EncodedValue adjustEncodedArray(EncodedValue encodedArray) {
    ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(32);
    new EncodedValueTransformer(out).transformArray(new EncodedValueReader(encodedArray, ENCODED_ARRAY));
    return new EncodedValue(out.toByteArray());
}
Also used : EncodedValue(com.taobao.android.dex.EncodedValue) EncodedValueReader(com.taobao.android.dex.EncodedValueReader) ByteArrayAnnotatedOutput(com.taobao.android.dx.util.ByteArrayAnnotatedOutput)

Example 3 with EncodedValueReader

use of com.taobao.android.dex.EncodedValueReader in project atlas by alibaba.

the class IndexMap method adjustEncodedValue.

public EncodedValue adjustEncodedValue(EncodedValue encodedValue) {
    ByteArrayAnnotatedOutput out = new ByteArrayAnnotatedOutput(32);
    new EncodedValueTransformer(out).transform(new EncodedValueReader(encodedValue));
    return new EncodedValue(out.toByteArray());
}
Also used : EncodedValue(com.taobao.android.dex.EncodedValue) EncodedValueReader(com.taobao.android.dex.EncodedValueReader) ByteArrayAnnotatedOutput(com.taobao.android.dx.util.ByteArrayAnnotatedOutput)

Aggregations

EncodedValueReader (com.taobao.android.dex.EncodedValueReader)3 EncodedValue (com.taobao.android.dex.EncodedValue)2 ByteArrayAnnotatedOutput (com.taobao.android.dx.util.ByteArrayAnnotatedOutput)2 ClassData (com.taobao.android.dex.ClassData)1 ClassDef (com.taobao.android.dex.ClassDef)1