FileDocCategorySizeDatePackage
CodeReader.javaAPI DocAndroid 5.1 API3604Thu Mar 12 22:18:30 GMT 2015com.android.dx.io

CodeReader

public final class CodeReader extends Object
Walks through a block of code and calls visitor call backs.

Fields Summary
private Visitor
fallbackVisitor
private Visitor
stringVisitor
private Visitor
typeVisitor
private Visitor
fieldVisitor
private Visitor
methodVisitor
Constructors Summary
Methods Summary
private voidcallVisit(com.android.dx.io.instructions.DecodedInstruction[] all, com.android.dx.io.instructions.DecodedInstruction one)

        Visitor visitor = null;

        switch (OpcodeInfo.getIndexType(one.getOpcode())) {
            case STRING_REF: visitor = stringVisitor; break;
            case TYPE_REF:   visitor = typeVisitor;   break;
            case FIELD_REF:  visitor = fieldVisitor;  break;
            case METHOD_REF: visitor = methodVisitor; break;
        }

        if (visitor == null) {
            visitor = fallbackVisitor;
        }

        if (visitor != null) {
            visitor.visit(all, one);
        }
    
public voidsetAllVisitors(com.android.dx.io.CodeReader$Visitor visitor)
Sets {@code visitor} as the visitor for all instructions.


                  
        
        fallbackVisitor = visitor;
        stringVisitor = visitor;
        typeVisitor = visitor;
        fieldVisitor = visitor;
        methodVisitor = visitor;
    
public voidsetFallbackVisitor(com.android.dx.io.CodeReader$Visitor visitor)
Sets {@code visitor} as the visitor for all instructions not otherwise handled.

        fallbackVisitor = visitor;
    
public voidsetFieldVisitor(com.android.dx.io.CodeReader$Visitor visitor)
Sets {@code visitor} as the visitor for all field instructions.

        fieldVisitor = visitor;
    
public voidsetMethodVisitor(com.android.dx.io.CodeReader$Visitor visitor)
Sets {@code visitor} as the visitor for all method instructions.

        methodVisitor = visitor;
    
public voidsetStringVisitor(com.android.dx.io.CodeReader$Visitor visitor)
Sets {@code visitor} as the visitor for all string instructions.

        stringVisitor = visitor;
    
public voidsetTypeVisitor(com.android.dx.io.CodeReader$Visitor visitor)
Sets {@code visitor} as the visitor for all type instructions.

        typeVisitor = visitor;
    
public voidvisitAll(com.android.dx.io.instructions.DecodedInstruction[] decodedInstructions)

        int size = decodedInstructions.length;

        for (int i = 0; i < size; i++) {
            DecodedInstruction one = decodedInstructions[i];
            if (one == null) {
                continue;
            }

            callVisit(decodedInstructions, one);
        }
    
public voidvisitAll(short[] encodedInstructions)

        DecodedInstruction[] decodedInstructions =
            DecodedInstruction.decodeAll(encodedInstructions);
        visitAll(decodedInstructions);