FileDocCategorySizeDatePackage
InstructionTransformer.javaAPI DocAndroid 5.1 API4496Thu Mar 12 22:18:30 GMT 2015com.android.dx.merge

InstructionTransformer

public final class InstructionTransformer extends Object

Fields Summary
private final IndexMap
indexMap
private final com.android.dx.io.CodeReader
reader
private com.android.dx.io.instructions.DecodedInstruction[]
mappedInstructions
private int
mappedAt
Constructors Summary
public InstructionTransformer(IndexMap indexMap)

        this.indexMap = indexMap;
        this.reader = new CodeReader();
        this.reader.setAllVisitors(new GenericVisitor());
        this.reader.setStringVisitor(new StringVisitor());
        this.reader.setTypeVisitor(new TypeVisitor());
        this.reader.setFieldVisitor(new FieldVisitor());
        this.reader.setMethodVisitor(new MethodVisitor());
    
Methods Summary
private static voidjumboCheck(boolean isJumbo, int newIndex)

        if (!isJumbo && (newIndex > 0xffff)) {
            throw new DexIndexOverflowException("Cannot merge new index " + newIndex +
                                   " into a non-jumbo instruction!");
        }
    
public short[]transform(short[] encodedInstructions)

        DecodedInstruction[] decodedInstructions =
            DecodedInstruction.decodeAll(encodedInstructions);
        int size = decodedInstructions.length;

        mappedInstructions = new DecodedInstruction[size];
        mappedAt = 0;
        reader.visitAll(decodedInstructions);

        ShortArrayCodeOutput out = new ShortArrayCodeOutput(size);
        for (DecodedInstruction instruction : mappedInstructions) {
            if (instruction != null) {
                instruction.encode(out);
            }
        }

        return out.getArray();