当前位置: 首页>>代码示例>>Java>>正文


Java ClassData.Method方法代码示例

本文整理汇总了Java中com.android.dex.ClassData.Method方法的典型用法代码示例。如果您正苦于以下问题:Java ClassData.Method方法的具体用法?Java ClassData.Method怎么用?Java ClassData.Method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.dex.ClassData的用法示例。


在下文中一共展示了ClassData.Method方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transformClassData

import com.android.dex.ClassData; //导入方法依赖的package包/类
private void transformClassData(Dex in, ClassData classData, IndexMap indexMap) {
    contentsOut.classDatas.size++;

    ClassData.Field[] staticFields = classData.getStaticFields();
    ClassData.Field[] instanceFields = classData.getInstanceFields();
    ClassData.Method[] directMethods = classData.getDirectMethods();
    ClassData.Method[] virtualMethods = classData.getVirtualMethods();

    classDataOut.writeUleb128(staticFields.length);
    classDataOut.writeUleb128(instanceFields.length);
    classDataOut.writeUleb128(directMethods.length);
    classDataOut.writeUleb128(virtualMethods.length);

    transformFields(indexMap, staticFields);
    transformFields(indexMap, instanceFields);
    transformMethods(in, indexMap, directMethods);
    transformMethods(in, indexMap, virtualMethods);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:DexMerger.java

示例2: transformMethods

import com.android.dex.ClassData; //导入方法依赖的package包/类
private void transformMethods(Dex in, IndexMap indexMap, ClassData.Method[] methods) {
    int lastOutMethodIndex = 0;
    for (ClassData.Method method : methods) {
        int outMethodIndex = indexMap.adjustMethod(method.getMethodIndex());
        classDataOut.writeUleb128(outMethodIndex - lastOutMethodIndex);
        lastOutMethodIndex = outMethodIndex;

        classDataOut.writeUleb128(method.getAccessFlags());

        if (method.getCodeOffset() == 0) {
            classDataOut.writeUleb128(0);
        } else {
            codeOut.alignToFourBytesWithZeroFill();
            classDataOut.writeUleb128(codeOut.getPosition());
            transformCode(in, in.readCode(method), indexMap);
        }
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:DexMerger.java

示例3: grep

import com.android.dex.ClassData; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:34,代码来源:Grep.java

示例4: findUsages

import com.android.dex.ClassData; //导入方法依赖的package包/类
/**
 * Prints usages to out.
 */
public void findUsages() {
    if (fieldIds == null || methodIds == null) {
        return;
    }

    for (ClassDef classDef : dex.classDefs()) {
        currentClass = classDef;
        currentMethod = null;

        if (classDef.getClassDataOffset() == 0) {
            continue;
        }

        ClassData classData = dex.readClassData(classDef);
        for (ClassData.Field field : classData.allFields()) {
            int fieldIndex = field.getFieldIndex();
            if (fieldIds.contains(fieldIndex)) {
                out.println(location() + " field declared " + dex.fieldIds().get(fieldIndex));
            }
        }

        for (ClassData.Method method : classData.allMethods()) {
            currentMethod = method;
            int methodIndex = method.getMethodIndex();
            if (methodIds.contains(methodIndex)) {
                out.println(location() + " method declared " + dex.methodIds().get(methodIndex));
            }
            if (method.getCodeOffset() != 0) {
                codeReader.visitAll(dex.readCode(method).getInstructions());
            }
        }
    }

    currentClass = null;
    currentMethod = null;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:40,代码来源:FindUsages.java


注:本文中的com.android.dex.ClassData.Method方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。