本文整理汇总了Java中com.android.dx.dex.cf.CfOptions类的典型用法代码示例。如果您正苦于以下问题:Java CfOptions类的具体用法?Java CfOptions怎么用?Java CfOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CfOptions类属于com.android.dx.dex.cf包,在下文中一共展示了CfOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DexConverter
import com.android.dx.dex.cf.CfOptions; //导入依赖的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);
}
示例2: defineClass
import com.android.dx.dex.cf.CfOptions; //导入依赖的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);
}
}
示例3: makeOptionsObjects
import com.android.dx.dex.cf.CfOptions; //导入依赖的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;
}
示例4: makeOptionsObjects
import com.android.dx.dex.cf.CfOptions; //导入依赖的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;
}
示例5: dex
import com.android.dx.dex.cf.CfOptions; //导入依赖的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);
}
}
示例6: makeOptionsObjects
import com.android.dx.dex.cf.CfOptions; //导入依赖的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;
}
示例7: makeOptionsObjects
import com.android.dx.dex.cf.CfOptions; //导入依赖的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;
}
示例8: makeOptionsObjects
import com.android.dx.dex.cf.CfOptions; //导入依赖的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;
}
示例9: makeOptionsObjects
import com.android.dx.dex.cf.CfOptions; //导入依赖的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.targetApiLevel = targetApiLevel;
}
示例10: generateDexFile
import com.android.dx.dex.cf.CfOptions; //导入依赖的package包/类
private OutputFile generateDexFile(OutputFile classFile) {
if (!classFile.getFullPath().startsWith(arguments.option_out())) {
Log.error("DexOutputProcess: Something is wrong with the class output path.");
return null;
}
String relativePath = classFile.getFullPath()
.substring(arguments.option_out().length() + 1);
// Remove a starting slash or backslash.
if (relativePath.startsWith("/") || relativePath.startsWith("\\")) {
relativePath = relativePath.substring(1);
}
Log.debug("DExing:" + relativePath);
CfOptions options = new CfOptions();
options.strictNameCheck = false;
ClassDefItem item = CfTranslator.translate(relativePath, classFile.getDataAsBytes(),
options);
DexFile dexFile = new DexFile();
dexFile.add(item);
try {
byte[] rawDex = dexFile.toDex(null, false);
OutputFile result = new OutputFile(rawDex);
result.setLocation(classFile.getLocation());
result.setFileName(classFile.getFileName().replace(ClassFile.CLASS_ENDING, DEX_ENDING));
return result;
} catch (IOException e) {
e.printStackTrace();
Log.error("Could not generate DEX file.");
}
return null;
}
示例11: toCfOptions
import com.android.dx.dex.cf.CfOptions; //导入依赖的package包/类
public CfOptions toCfOptions(DxContext context) {
CfOptions result = new CfOptions();
result.localInfo = this.localInfo;
result.optimize = this.optimize;
result.warn = printWarnings ? context.err : Dexing.nullout;
// Use dx's defaults
result.optimizeListFile = null;
result.dontOptimizeListFile = null;
result.positionInfo = positionInfo;
result.strictNameCheck = true;
result.statistics = false; // we're not supporting statistics anyways
return result;
}
示例12: convertClass
import com.android.dx.dex.cf.CfOptions; //导入依赖的package包/类
private static DexFile convertClass(Class<?> clazz) throws IOException {
String path = clazz.getName().replace('.', '/') + ".class";
try (InputStream in =
Thread.currentThread().getContextClassLoader().getResourceAsStream(path)) {
return new DexConverter(new Dexing(new DxContext(), new DexOptions(), new CfOptions()))
.toDexFile(ByteStreams.toByteArray(in), path);
}
}
示例13: makeStuffer
import com.android.dx.dex.cf.CfOptions; //导入依赖的package包/类
private void makeStuffer() {
stuffer =
new DexConversionEnqueuer(
zip,
newDirectExecutorService(),
new DexConverter(new Dexing(new DxContext(), new DexOptions(), new CfOptions())),
cache);
}
示例14: addClass
import com.android.dx.dex.cf.CfOptions; //导入依赖的package包/类
public void addClass(String nameClass, byte[] byteClass) {
final CfOptions cf_options = new CfOptions();
//System.out.println(nameClass);
final ClassDefItem cdi = CfTranslator.translate(nameClass, byteClass, cf_options, dex_options);
file.add(cdi);
}
示例15: Dexing
import com.android.dx.dex.cf.CfOptions; //导入依赖的package包/类
@VisibleForTesting
Dexing(DxContext context, DexOptions dexOptions, CfOptions cfOptions) {
this.context = context;
this.dexOptions = dexOptions;
this.cfOptions = cfOptions;
}