本文整理汇总了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);
}
示例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);
}
}
}
示例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;
}
示例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;
}