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


Java AccessFlags类代码示例

本文整理汇总了Java中org.jf.dexlib.Util.AccessFlags的典型用法代码示例。如果您正苦于以下问题:Java AccessFlags类的具体用法?Java AccessFlags怎么用?Java AccessFlags使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TempClassInfo

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
public TempClassInfo(String dexFilePath, ClassDefItem classDefItem) {
    this.dexFilePath = dexFilePath;

    classType = classDefItem.getClassType().getTypeDescriptor();

    isInterface = (classDefItem.getAccessFlags() & AccessFlags.INTERFACE.getValue()) != 0;

    TypeIdItem superclassType = classDefItem.getSuperclass();
    if (superclassType == null) {
        this.superclassType = null;
    } else {
        this.superclassType = superclassType.getTypeDescriptor();
    }

    interfaces = loadInterfaces(classDefItem);

    ClassDataItem classDataItem = classDefItem.getClassData();
    if (classDataItem != null) {
        virtualMethods = loadVirtualMethods(classDataItem);
        instanceFields = loadInstanceFields(classDataItem);
    } else {
        virtualMethods = null;
        instanceFields = null;
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:26,代码来源:ClassPath.java

示例2: writeItem

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
/** {@inheritDoc} */
protected void writeItem(AnnotatedOutput out) {
    if (out.annotates()) {
        out.annotate(4, "class_type: " + classType.getTypeDescriptor());
        out.annotate(4, "access_flags: " + AccessFlags.formatAccessFlagsForClass(accessFlags));
        out.annotate(4, "superclass_type: " + (superType==null?"":superType.getTypeDescriptor()));
        out.annotate(4, "interfaces: " +
                (implementedInterfaces==null?"":implementedInterfaces.getTypeListString(" ")));
        out.annotate(4, "source_file: " + (sourceFile==null?"":sourceFile.getStringValue()));
        out.annotate(4, "annotations_off: " +
                (annotations==null?"":"0x"+Integer.toHexString(annotations.getOffset())));
        out.annotate(4, "class_data_off:" +
                (classData==null?"":"0x"+Integer.toHexString(classData.getOffset())));
        out.annotate(4, "static_values_off: " +
                (staticFieldInitializers==null?"":"0x"+Integer.toHexString(staticFieldInitializers.getOffset())));
    }
    out.writeInt(classType.getIndex());
    out.writeInt(accessFlags);
    out.writeInt(superType==null?-1:superType.getIndex());
    out.writeInt(implementedInterfaces==null?0:implementedInterfaces.getOffset());
    out.writeInt(sourceFile==null?-1:sourceFile.getIndex());
    out.writeInt(annotations==null?0:annotations.getOffset());
    out.writeInt(classData==null?0:classData.getOffset());
    out.writeInt(staticFieldInitializers==null?0:staticFieldInitializers.getOffset());
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:26,代码来源:ClassDefItem.java

示例3: ClassDef

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
protected ClassDef(ClassDefItem classDefItem) {
    classType = classDefItem.getClassType().getTypeDescriptor();

    isInterface = (classDefItem.getAccessFlags() & AccessFlags.INTERFACE.getValue()) != 0;

    superclass = loadSuperclass(classDefItem);
    if (superclass == null) {
        classDepth = 0;
    } else {
        classDepth = superclass.classDepth + 1;
    }

    implementedInterfaces = loadAllImplementedInterfaces(classDefItem);

    vtable = loadVtable(classDefItem);
    virtualMethodLookup = new HashMap<String, Integer>((int)Math.ceil(vtable.length / .7f), .75f);
    for (int i=0; i<vtable.length; i++) {
        virtualMethodLookup.put(vtable[i], i);
    }

    instanceFields = loadFields(classDefItem);
    instanceFieldLookup = new HashMap<String, Integer>((int)Math.ceil(instanceFields.size() / .7f), .75f);
    for (int i=0; i<instanceFields.size(); i++) {
        instanceFieldLookup.put(instanceFields.get(i), i);
    }
}
 
开发者ID:Sukelluskello,项目名称:VectorAttackScanner,代码行数:27,代码来源:ClassPath.java

示例4: loadDirectMethods

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private String[] loadDirectMethods(ClassDataItem classDataItem, boolean[][] _staticMethods) {
    List<EncodedMethod> encodedMethods = classDataItem.getDirectMethods();
    if (encodedMethods.size() > 0) {
        boolean[] staticMethods = new boolean[encodedMethods.size()];
        String[] directMethods = new String[encodedMethods.size()];

        for (int i=0; i<encodedMethods.size(); i++) {
            EncodedMethod encodedMethod = encodedMethods.get(i);

            if ((encodedMethod.accessFlags & AccessFlags.STATIC.getValue()) != 0) {
                staticMethods[i] = true;
            }
            directMethods[i] = encodedMethod.method.getShortMethodString();
        }
        _staticMethods[0] = staticMethods;
        return directMethods;
    }
    return null;
}
 
开发者ID:longluo,项目名称:smali,代码行数:20,代码来源:ClassPath.java

示例5: getRegisterCount

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private static int getRegisterCount(ClassDataItem.EncodedMethod encodedMethod)
{
    int totalRegisters = encodedMethod.codeItem.getRegisterCount();
    if (baksmali.useLocalsDirective) {
        int parameterRegisters = encodedMethod.method.getPrototype().getParameterRegisterCount();
        if ((encodedMethod.accessFlags & AccessFlags.STATIC.getValue()) == 0) {
            parameterRegisters++;
        }
        return totalRegisters - parameterRegisters;
    }
    return totalRegisters;
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:13,代码来源:MethodDefinition.java

示例6: writeAccessFlags

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private static void writeAccessFlags(IndentingWriter writer, ClassDataItem.EncodedMethod encodedMethod)
                                                                                        throws IOException {
    for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForMethod(encodedMethod.accessFlags)) {
        writer.write(accessFlag.toString());
        writer.write(' ');
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:8,代码来源:MethodDefinition.java

示例7: addParamRegs

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private void addParamRegs(BitSet registers, int registerCount) {
    ClassDataItem.EncodedMethod encodedMethod = methodAnalyzer.getMethod();
    int parameterRegisterCount = encodedMethod.method.getPrototype().getParameterRegisterCount();
    if ((encodedMethod.accessFlags & AccessFlags.STATIC.getValue()) == 0) {
        parameterRegisterCount++;
    }

    registers.set(registerCount-parameterRegisterCount, registerCount);
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:10,代码来源:PreInstructionRegisterInfoMethodItem.java

示例8: writeTo

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
/**
 * Writes a register with the appropriate format. If baksmali.noParameterRegisters is true, then it will always
 * output a register in the v<n> format. If false, then it determines if the register is a parameter register,
 * and if so, formats it in the p<n> format instead.
 *
 * @param writer the <code>IndentingWriter</code> to write to
 * @param codeItem the <code>CodeItem</code> that the register is from
 * @param register the register number
 */
public static void writeTo(IndentingWriter writer, CodeItem codeItem, int register) throws IOException {
    if (!baksmali.noParameterRegisters) {
        int parameterRegisterCount = codeItem.getParent().method.getPrototype().getParameterRegisterCount()
                + (((codeItem.getParent().accessFlags & AccessFlags.STATIC.getValue())==0)?1:0);
        int registerCount = codeItem.getRegisterCount();
        if (register >= registerCount - parameterRegisterCount) {
            writer.write('p');
            writer.printIntAsDec((register - (registerCount - parameterRegisterCount)));
            return;
        }
    }
    writer.write('v');
    writer.printIntAsDec(register);
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:24,代码来源:RegisterFormatter.java

示例9: writeTo

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
public static void writeTo(IndentingWriter writer, ClassDataItem.EncodedField encodedField,
                                            EncodedValue initialValue, AnnotationSetItem annotationSet,
                                            boolean setInStaticConstructor) throws IOException {

    String fieldTypeDescriptor = encodedField.field.getFieldType().getTypeDescriptor();

    if (setInStaticConstructor &&
        encodedField.isStatic() &&
        (encodedField.accessFlags & AccessFlags.FINAL.getValue()) != 0 &&
        initialValue != null &&
        (
            //it's a primitive type, or it's an array/reference type and the initial value isn't null
            fieldTypeDescriptor.length() == 1 ||
            initialValue != NullEncodedValue.NullValue
        )) {

        writer.write("#the value of this static final field might be set in the static constructor\n");
    }

    writer.write(".field ");
    writeAccessFlags(writer, encodedField);
    writer.write(encodedField.field.getFieldName().getStringValue());
    writer.write(':');
    writer.write(encodedField.field.getFieldType().getTypeDescriptor());
    if (initialValue != null) {
        writer.write(" = ");
        EncodedValueAdaptor.writeTo(writer, initialValue);
    }

    writer.write('\n');

    if (annotationSet != null) {
        writer.indent(4);
        AnnotationFormatter.writeTo(writer, annotationSet);
        writer.deindent(4);
        writer.write(".end field\n");
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:39,代码来源:FieldDefinition.java

示例10: writeAccessFlags

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private static void writeAccessFlags(IndentingWriter writer, ClassDataItem.EncodedField encodedField)
                                                                                             throws IOException {
    for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForField(encodedField.accessFlags)) {
        writer.write(accessFlag.toString());
        writer.write(' ');
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:8,代码来源:FieldDefinition.java

示例11: UnresolvedClassInfo

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
public UnresolvedClassInfo(String dexFilePath, ClassDefItem classDefItem) {
    this.dexFilePath = dexFilePath;

    classType = classDefItem.getClassType().getTypeDescriptor();

    isPublic = (classDefItem.getAccessFlags() & AccessFlags.PUBLIC.getValue()) != 0;
    isInterface = (classDefItem.getAccessFlags() & AccessFlags.INTERFACE.getValue()) != 0;

    TypeIdItem superclassType = classDefItem.getSuperclass();
    if (superclassType == null) {
        this.superclassType = null;
    } else {
        this.superclassType = superclassType.getTypeDescriptor();
    }

    interfaces = loadInterfaces(classDefItem);

    ClassDataItem classDataItem = classDefItem.getClassData();
    if (classDataItem != null) {
        boolean[][] _staticMethods = new boolean[1][];
        directMethods = loadDirectMethods(classDataItem, _staticMethods);
        staticMethods = _staticMethods[0];
        virtualMethods = loadVirtualMethods(classDataItem);
        instanceFields = loadInstanceFields(classDataItem);
    } else {
        staticMethods = null;
        directMethods = null;
        virtualMethods = null;
        instanceFields = null;
    }
}
 
开发者ID:longluo,项目名称:smali,代码行数:32,代码来源:ClassPath.java

示例12: writeTo

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
/**
 * Writes a register with the appropriate format. If baksmali.noParameterRegisters is true, then it will always
 * output a register in the v<n> format. If false, then it determines if the register is a parameter register,
 * and if so, formats it in the p<n> format instead.
 *
 * @param writer the <code>IndentingWriter</code> to write to
 * @param codeItem the <code>CodeItem</code> that the register is from
 * @param register the register number
 */
public static void writeTo(IndentingWriter writer, CodeItem codeItem, int register) throws IOException {
    if (!baksmali.noParameterRegisters) {
        int parameterRegisterCount = codeItem.getParent().method.getPrototype().getParameterRegisterCount()
                + (((codeItem.getParent().accessFlags & AccessFlags.STATIC.getValue())==0)?1:0);
        int registerCount = codeItem.getRegisterCount();
        if (register >= registerCount - parameterRegisterCount) {
            writer.write('p');
            writer.printSignedIntAsDec((register - (registerCount - parameterRegisterCount)));
            return;
        }
    }
    writer.write('v');
    writer.printSignedIntAsDec(register);
}
 
开发者ID:longluo,项目名称:smali,代码行数:24,代码来源:RegisterFormatter.java

示例13: isInstanceConstructor

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private boolean isInstanceConstructor() {
    return (encodedMethod.accessFlags & AccessFlags.STATIC.getValue()) == 0 &&
           (encodedMethod.accessFlags & AccessFlags.CONSTRUCTOR.getValue()) != 0;
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:5,代码来源:MethodAnalyzer.java

示例14: isStaticConstructor

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private boolean isStaticConstructor() {
    return (encodedMethod.accessFlags & AccessFlags.STATIC.getValue()) != 0 &&
           (encodedMethod.accessFlags & AccessFlags.CONSTRUCTOR.getValue()) != 0;
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:5,代码来源:MethodAnalyzer.java

示例15: writeAccessFlags

import org.jf.dexlib.Util.AccessFlags; //导入依赖的package包/类
private void writeAccessFlags(IndentingWriter writer) throws IOException {
    for (AccessFlags accessFlag: AccessFlags.getAccessFlagsForClass(classDefItem.getAccessFlags())) {
        writer.write(accessFlag.toString());
        writer.write(' ');
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:7,代码来源:ClassDefinition.java


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