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


Java DexOptions类代码示例

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


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

示例1: DexConverter

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
public DexConverter() {
    this.cfOptions = new CfOptions();
    this.cfOptions.positionInfo = 2;
    this.cfOptions.localInfo = true;
    this.cfOptions.strictNameCheck = false;
    this.cfOptions.optimize = true;
    this.cfOptions.optimizeListFile = null;
    this.cfOptions.dontOptimizeListFile = null;
    this.cfOptions.statistics = false;
    this.cfOptions.warn = DxConsole.noop;

    this.dexOptions = new DexOptions();
    this.dexOptions.forceJumbo = false;

    outputDex = new DexFile(dexOptions);
}
 
开发者ID:imkiva,项目名称:Krine,代码行数:17,代码来源:DexConverter.java

示例2: defineClass

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Class<?> defineClass(String name, byte[] data) {
    try {
        DexOptions dexOptions = new DexOptions();
        DexFile dexFile = new DexFile(dexOptions);
        DirectClassFile classFile = new DirectClassFile(data, name.replace('.', '/') + ".class", true);
        classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
        classFile.getMagic();
        dexFile.add(CfTranslator.translate(classFile, null, new CfOptions(), dexOptions, dexFile));
        Dex dex = new Dex(dexFile.toDex(null, false));
        Dex oldDex = getLastDex();
        if (oldDex != null) {
            dex = new DexMerger(new Dex[]{dex, oldDex}, CollisionPolicy.KEEP_FIRST).merge();
        }
        return loadClass(dex, name);
    } catch (IOException | ClassNotFoundException e) {
        throw new FatalLoadingException(e);
    }
}
 
开发者ID:F43nd1r,项目名称:rhino-android,代码行数:23,代码来源:BaseAndroidClassLoader.java

示例3: makeOptionsObjects

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Copies relevent arguments over into CfOptions and
 * DexOptions instances.
 */
private void makeOptionsObjects() {
    cfOptions = new CfOptions();
    cfOptions.positionInfo = positionInfo;
    cfOptions.localInfo = localInfo;
    cfOptions.strictNameCheck = strictNameCheck;
    cfOptions.optimize = optimize;
    cfOptions.optimizeListFile = optimizeListFile;
    cfOptions.dontOptimizeListFile = dontOptimizeListFile;
    cfOptions.statistics = statistics;

    if (warnings) {
        cfOptions.warn = System.err;
    } else {
        cfOptions.warn = System.err;
    }

    dexOptions = new DexOptions();
    dexOptions.forceJumbo = forceJumbo;
}
 
开发者ID:RunasSudo,项目名称:PyAndroid,代码行数:24,代码来源:Dexer.java

示例4: getNextOrNull

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Gets the next {@link Dop} in the instruction fitting chain after the
 * given instance, if any.
 *
 * @param opcode {@code non-null;} the opcode
 * @param options {@code non-null;} options, used to determine
 * which opcodes are potentially off-limits
 * @return {@code null-ok;} the next opcode in the same family, in the
 * chain of opcodes to try, or {@code null} if the given opcode is
 * the last in its chain
 */
public static Dop getNextOrNull(Dop opcode, DexOptions options) {
    boolean suppressExtendedOpcodes = !options.canUseExtendedOpcodes();

    for (;;) {
        int nextOpcode = opcode.getNextOpcode();

        if (nextOpcode == Opcodes.NO_NEXT) {
            return null;
        }

        opcode = get(nextOpcode);

        if (suppressExtendedOpcodes && Opcodes.isExtended(nextOpcode)) {
            /*
             * Continuing rather than just returning null here
             * protects against the possibility that an
             * instruction fitting chain might list non-extended
             * opcodes after extended ones.
             */
            continue;
        }

        return opcode;
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:37,代码来源:Dops.java

示例5: makeOptionsObjects

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Copies relevent arguments over into CfOptions and
 * DexOptions instances.
 */
private void makeOptionsObjects() {
    cfOptions = new CfOptions();
    cfOptions.positionInfo = positionInfo;
    cfOptions.localInfo = localInfo;
    cfOptions.strictNameCheck = strictNameCheck;
    cfOptions.optimize = optimize;
    cfOptions.optimizeListFile = optimizeListFile;
    cfOptions.dontOptimizeListFile = dontOptimizeListFile;
    cfOptions.statistics = statistics;

    if (warnings) {
        cfOptions.warn = DxConsole.err;
    } else {
        cfOptions.warn = DxConsole.noop;
    }

    dexOptions = new DexOptions();
    dexOptions.forceJumbo = forceJumbo;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:24,代码来源:Main.java

示例6: dex

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
private static final byte[] dex(String className, byte[] classData) throws ClassFormatError {
    try {
        DexOptions dexOptions = new DexOptions();
        DexFile dxFile = new DexFile(dexOptions);
        CfOptions cfOptions = new CfOptions();
        dxFile.add(CfTranslator.translate(className.replace('.', '/') + ".class", classData, cfOptions, dexOptions));
        StringWriter out = BridJ.debug ? new StringWriter() : null;
        byte[] dexData = dxFile.toDex(out, false);
        if (BridJ.debug) {
            BridJ.info("Dex output for class " + className + " : " + out);
        }
        return dexData;
    } catch (IOException ex) {
        throw new ClassFormatError("Unable to convert class data to Dalvik code using Dex : " + ex);
    }
}
 
开发者ID:nativelibs4java,项目名称:BridJ,代码行数:17,代码来源:AndroidClassDefiner.java

示例7: makeOptionsObjects

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Copies relevent arguments over into CfOptions and
 * DexOptions instances.
 */
private void makeOptionsObjects() {
    cfOptions = new CfOptions();
    cfOptions.positionInfo = positionInfo;
    cfOptions.localInfo = localInfo;
    cfOptions.strictNameCheck = strictNameCheck;
    cfOptions.optimize = optimize;
    cfOptions.optimizeListFile = optimizeListFile;
    cfOptions.dontOptimizeListFile = dontOptimizeListFile;
    cfOptions.statistics = statistics;
    cfOptions.warn = dxConsole.err;
    cfOptions.codeStatistics = new CodeStatistics();

    dexOptions = new DexOptions();
    dexOptions.forceJumbo = forceJumbo;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:20,代码来源:Main.java

示例8: makeOptionsObjects

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Copies relevant arguments over into CfOptions and
 * DexOptions instances.
 */
public void makeOptionsObjects(DxContext context) {
    cfOptions = new CfOptions();
    cfOptions.positionInfo = positionInfo;
    cfOptions.localInfo = localInfo;
    cfOptions.strictNameCheck = strictNameCheck;
    cfOptions.optimize = optimize;
    cfOptions.optimizeListFile = optimizeListFile;
    cfOptions.dontOptimizeListFile = dontOptimizeListFile;
    cfOptions.statistics = statistics;

    if (warnings) {
        cfOptions.warn = context.err;
    } else {
        cfOptions.warn = context.noop;
    }

    dexOptions = new DexOptions();
    dexOptions.forceJumbo = forceJumbo;
}
 
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:Main.java

示例9: getNextOrNull

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Gets the next {@link Dop} in the instruction fitting chain after the
 * given instance, if any.
 *
 * @param opcode {@code non-null;} the opcode
 * @param options {@code non-null;} options, used to determine
 * which opcodes are potentially off-limits
 * @return {@code null-ok;} the next opcode in the same family, in the
 * chain of opcodes to try, or {@code null} if the given opcode is
 * the last in its chain
 */
public static Dop getNextOrNull(Dop opcode, DexOptions options) {
  int nextOpcode = opcode.getNextOpcode();

  if (nextOpcode == Opcodes.NO_NEXT) {
    return null;
  }

  opcode = get(nextOpcode);

  return opcode;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:Dops.java

示例10: OutputFinisher

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Constructs an instance. It initially contains no instructions.
 *
 * @param dexOptions {@code non-null;} options for dex output
 * @param initialCapacity {@code >= 0;} initial capacity of the
 * instructions list
 * @param regCount {@code >= 0;} register count for the method
 * @param paramSize size, in register units, of all the parameters for this method
 */
public OutputFinisher(DexOptions dexOptions, int initialCapacity, int regCount, int paramSize) {
    this.dexOptions = dexOptions;
    this.unreservedRegCount = regCount;
    this.insns = new ArrayList<DalvInsn>(initialCapacity);
    this.reservedCount = -1;
    this.hasAnyPositionInfo = false;
    this.hasAnyLocalInfo = false;
    this.paramSize = paramSize;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:OutputFinisher.java

示例11: updateDexStatistics

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Helper that updates the dex statistics.
 */
private static void updateDexStatistics(CfOptions cfOptions, DexOptions dexOptions,
        RopMethod optRmeth, RopMethod nonOptRmeth,
        LocalVariableInfo locals, int paramSize, int originalByteCount) {
    /*
     * Run rop->dex again on optimized vs. non-optimized method to
     * collect statistics. We have to totally convert both ways,
     * since converting the "real" method getting added to the
     * file would corrupt it (by messing with its constant pool
     * indices).
     */

    DalvCode optCode = RopTranslator.translate(optRmeth,
            cfOptions.positionInfo, locals, paramSize, dexOptions);
    DalvCode nonOptCode = RopTranslator.translate(nonOptRmeth,
            cfOptions.positionInfo, locals, paramSize, dexOptions);

    /*
     * Fake out the indices, so code.getInsns() can work well enough
     * for the current purpose.
     */

    DalvCode.AssignIndicesCallback callback =
        new DalvCode.AssignIndicesCallback() {
            public int getIndex(Constant cst) {
                // Everything is at index 0!
                return 0;
            }
        };

    optCode.assignIndices(callback);
    nonOptCode.assignIndices(callback);

    CodeStatistics.updateDexStatistics(nonOptCode, optCode);
    CodeStatistics.updateOriginalByteCount(originalByteCount);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:39,代码来源:CfTranslator.java

示例12: DexFile

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Constructs an instance. It is initially empty.
 */
public DexFile(DexOptions dexOptions) {
    this.dexOptions = dexOptions;

    header = new HeaderSection(this);
    typeLists = new MixedItemSection(null, this, 4, SortType.NONE);
    wordData = new MixedItemSection("word_data", this, 4, SortType.TYPE);
    stringData =
        new MixedItemSection("string_data", this, 1, SortType.INSTANCE);
    classData = new MixedItemSection(null, this, 1, SortType.NONE);
    byteData = new MixedItemSection("byte_data", this, 1, SortType.TYPE);
    stringIds = new StringIdsSection(this);
    typeIds = new TypeIdsSection(this);
    protoIds = new ProtoIdsSection(this);
    fieldIds = new FieldIdsSection(this);
    methodIds = new MethodIdsSection(this);
    classDefs = new ClassDefsSection(this);
    map = new MixedItemSection("map", this, 4, SortType.NONE);

    /*
     * This is the list of sections in the order they appear in
     * the final output.
     */
    sections = new Section[] {
        header, stringIds, typeIds, protoIds, fieldIds, methodIds,
        classDefs, wordData, typeLists, stringData, byteData,
        classData, map };

    fileSize = -1;
    dumpWidth = 79;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:34,代码来源:DexFile.java

示例13: getAlignment

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Return the register alignment constraint to have 64-bits registers that will be align on even
 * dalvik registers after that parameter registers are move up to the top of the frame to match
 * the calling convention.
 *
 * @param regCategory category of the register that will be aligned.
 * @return the register alignment constraint.
 */
private Alignment getAlignment(int regCategory) {
  Alignment alignment = Alignment.UNSPECIFIED;

  if (DexOptions.ALIGN_64BIT_REGS_SUPPORT && regCategory == 2) {
    if (isEven(paramRangeEnd)) {
      alignment = Alignment.EVEN;
    } else {
      alignment = Alignment.ODD;
    }
  }

  return alignment;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:22,代码来源:FirstFitLocalCombiningAllocator.java

示例14: makeOptionsObjects

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Copies relevent arguments over into CfOptions and
 * DexOptions instances.
 */
private void makeOptionsObjects() {
    cfOptions = new CfOptions();
    cfOptions.positionInfo = positionInfo;
    cfOptions.localInfo = localInfo;
    cfOptions.strictNameCheck = strictNameCheck;
    cfOptions.optimize = optimize;
    cfOptions.optimizeListFile = optimizeListFile;
    cfOptions.dontOptimizeListFile = dontOptimizeListFile;
    cfOptions.statistics = statistics;
    cfOptions.warn = DxConsole.err;

    dexOptions = new DexOptions();
    dexOptions.forceJumbo = forceJumbo;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:19,代码来源:Main.java

示例15: OutputFinisher

import com.android.dx.dex.DexOptions; //导入依赖的package包/类
/**
 * Constructs an instance. It initially contains no instructions.
 *
 * @param dexOptions {@code non-null;} options for dex output
 * @param regCount {@code >= 0;} register count for the method
 * @param initialCapacity {@code >= 0;} initial capacity of the
 * instructions list
 */
public OutputFinisher(DexOptions dexOptions, int initialCapacity, int regCount) {
    this.dexOptions = dexOptions;
    this.unreservedRegCount = regCount;
    this.insns = new ArrayList<DalvInsn>(initialCapacity);
    this.reservedCount = -1;
    this.hasAnyPositionInfo = false;
    this.hasAnyLocalInfo = false;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:OutputFinisher.java


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