本文整理汇总了Java中com.android.dx.command.DxConsole类的典型用法代码示例。如果您正苦于以下问题:Java DxConsole类的具体用法?Java DxConsole怎么用?Java DxConsole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DxConsole类属于com.android.dx.command包,在下文中一共展示了DxConsole类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: DexConverter
import com.android.dx.command.DxConsole; //导入依赖的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: processClass
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Processes one classfile.
*
* @param name {@code non-null;} name of the file, clipped such that it
* <i>should</i> correspond to the name of the class it contains
* @param bytes {@code non-null;} contents of the file
* @return whether processing was successful
*/
private static boolean processClass(String name, byte[] bytes) {
if (! args.coreLibrary) {
checkClassName(name);
}
try {
ClassDefItem clazz =
CfTranslator.translate(name, bytes, args.cfOptions, args.dexOptions);
synchronized (outputDex) {
outputDex.add(clazz);
}
return true;
} catch (ParseException ex) {
DxConsole.err.println("\ntrouble processing:");
if (args.debug) {
ex.printStackTrace(DxConsole.err);
} else {
ex.printContext(DxConsole.err);
}
}
warnings++;
return false;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:33,代码来源:Main.java
示例3: makeOptionsObjects
import com.android.dx.command.DxConsole; //导入依赖的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
示例4: onException
import com.android.dx.command.DxConsole; //导入依赖的package包/类
@Override
public void onException(Exception ex) {
if (ex instanceof StopProcessing) {
throw (StopProcessing) ex;
} else if (ex instanceof SimException) {
DxConsole.err.println("\nEXCEPTION FROM SIMULATION:");
DxConsole.err.println(ex.getMessage() + "\n");
DxConsole.err.println(((SimException) ex).getContext());
} else if (ex instanceof ParseException) {
DxConsole.err.println("\nPARSE ERROR:");
ParseException parseException = (ParseException) ex;
if (args.debug) {
parseException.printStackTrace(DxConsole.err);
} else {
parseException.printContext(DxConsole.err);
}
} else {
DxConsole.err.println("\nUNEXPECTED TOP-LEVEL EXCEPTION:");
ex.printStackTrace(DxConsole.err);
}
errors.incrementAndGet();
}
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:Main.java
示例5: checkClassName
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Check the class name to make sure it's not a "core library"
* class. If there is a problem, this updates the error count and
* throws an exception to stop processing.
*
* @param name {@code non-null;} the fully-qualified internal-form
* class name
*/
private static void checkClassName(String name) {
boolean bogus = false;
if (name.startsWith("java/")) {
bogus = true;
} else if (name.startsWith("javax/")) {
int slashAt = name.indexOf('/', 6);
if (slashAt == -1) {
// Top-level javax classes are verboten.
bogus = true;
} else {
String pkg = name.substring(6, slashAt);
bogus = (Arrays.binarySearch(JAVAX_CORE, pkg) >= 0);
}
}
if (! bogus) {
return;
}
/*
* The user is probably trying to include an entire desktop
* core library in a misguided attempt to get their application
* working. Try to help them understand what's happening.
*/
DxConsole.err.println("\ntrouble processing \"" + name + "\":\n\n" +
IN_RE_CORE_CLASSES);
errors.incrementAndGet();
throw new StopProcessing();
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:40,代码来源:Main.java
示例6: makeOptionsObjects
import com.android.dx.command.DxConsole; //导入依赖的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
示例7: checkClassName
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Check the class name to make sure it's not a "core library"
* class. If there is a problem, this updates the error count and
* throws an exception to stop processing.
*
* @param name {@code non-null;} the fully-qualified internal-form
* class name
*/
private static void checkClassName(String name) {
boolean bogus = false;
if (name.startsWith("java/")) {
bogus = true;
} else if (name.startsWith("javax/")) {
int slashAt = name.indexOf('/', 6);
if (slashAt == -1) {
// Top-level javax classes are verboten.
bogus = true;
} else {
String pkg = name.substring(6, slashAt);
bogus = (Arrays.binarySearch(JAVAX_CORE, pkg) >= 0);
}
}
if (! bogus) {
return;
}
/*
* The user is probably trying to include an entire desktop
* core library in a misguided attempt to get their application
* working. Try to help them understand what's happening.
*/
DxConsole.err.println("\ntrouble processing \"" + name + "\":\n\n" +
IN_RE_CORE_CLASSES);
errors++;
throw new StopProcessing();
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:40,代码来源:Main.java
示例8: makeOptionsObjects
import com.android.dx.command.DxConsole; //导入依赖的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;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:19,代码来源:Main.java
示例9: translateClass
import com.android.dx.command.DxConsole; //导入依赖的package包/类
private static ClassDefItem translateClass(byte[] bytes, DirectClassFile cf) {
try {
return CfTranslator.translate(cf, bytes, args.cfOptions,
args.dexOptions, outputDex);
} catch (ParseException ex) {
DxConsole.err.println("\ntrouble processing:");
if (args.debug) {
ex.printStackTrace(DxConsole.err);
} else {
ex.printContext(DxConsole.err);
}
}
errors.incrementAndGet();
return null;
}
开发者ID:johnlee175,项目名称:dex,代码行数:16,代码来源:Main.java
示例10: run
import com.android.dx.command.DxConsole; //导入依赖的package包/类
public int run(String[] args, PrintStream out, PrintStream err) throws IOException {
DxConsole console = new DxConsole();
if (out != null) {
console.out = out;
}
if (err != null) {
console.err = err;
}
Arguments arguments = new Arguments();
arguments.parse(args);
return run(arguments, console);
}
开发者ID:saleehk,项目名称:buck-cutom,代码行数:15,代码来源:Main.java
示例11: processFileBytes
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Processes one file, which may be either a class or a resource.
*
* @param name {@code non-null;} name of the file
* @param bytes {@code non-null;} contents of the file
* @return whether processing was successful
*/
private static boolean processFileBytes(String name, long lastModified, byte[] bytes) {
boolean isClass = name.endsWith(".class");
boolean isClassesDex = name.equals(DexFormat.DEX_IN_JAR_NAME);
boolean keepResources = (outputResources != null);
if (!isClass && !isClassesDex && !keepResources) {
if (args.verbose) {
DxConsole.out.println("ignored resource " + name);
}
return false;
}
if (args.verbose) {
DxConsole.out.println("processing " + name + "...");
}
String fixedName = fixPath(name);
if (isClass) {
if (keepResources && args.keepClassesInJar) {
synchronized (outputResources) {
outputResources.put(fixedName, bytes);
}
}
if (lastModified < minimumFileAge) {
return true;
}
return processClass(fixedName, bytes);
} else if (isClassesDex) {
synchronized (libraryDexBuffers) {
libraryDexBuffers.add(bytes);
}
return true;
} else {
synchronized (outputResources) {
outputResources.put(fixedName, bytes);
}
return true;
}
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:49,代码来源:Main.java
示例12: writeDex
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Converts {@link #outputDex} into a {@code byte[]} and do whatever
* human-oriented dumping is required.
*
* @return {@code null-ok;} the converted {@code byte[]} or {@code null}
* if there was a problem
*/
private static byte[] writeDex() {
byte[] outArray = null;
try {
try {
if (args.methodToDump != null) {
/*
* Simply dump the requested method. Note: The call
* to toDex() is required just to get the underlying
* structures ready.
*/
outputDex.toDex(null, false);
dumpMethod(outputDex, args.methodToDump, humanOutWriter);
} else {
/*
* This is the usual case: Create an output .dex file,
* and write it, dump it, etc.
*/
outArray = outputDex.toDex(humanOutWriter, args.verboseDump);
}
if (args.statistics) {
DxConsole.out.println(outputDex.getStatistics().toHuman());
}
} finally {
if (humanOutWriter != null) {
humanOutWriter.flush();
}
}
} catch (Exception ex) {
if (args.debug) {
DxConsole.err.println("\ntrouble writing output:");
ex.printStackTrace(DxConsole.err);
} else {
DxConsole.err.println("\ntrouble writing output: " +
ex.getMessage());
}
return null;
}
return outArray;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:50,代码来源:Main.java
示例13: createJar
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Creates a jar file from the resources (including dex file arrays).
*
* @param fileName {@code non-null;} name of the file
* @return whether the creation was successful
*/
private static boolean createJar(String fileName) {
/*
* Make or modify the manifest (as appropriate), put the dex
* array into the resources map, and then process the entire
* resources map in a uniform manner.
*/
try {
Manifest manifest = makeManifest();
OutputStream out = openOutput(fileName);
JarOutputStream jarOut = new JarOutputStream(out, manifest);
try {
for (Map.Entry<String, byte[]> e :
outputResources.entrySet()) {
String name = e.getKey();
byte[] contents = e.getValue();
JarEntry entry = new JarEntry(name);
int length = contents.length;
if (args.verbose) {
DxConsole.out.println("writing " + name + "; size " + length + "...");
}
entry.setSize(length);
jarOut.putNextEntry(entry);
jarOut.write(contents);
jarOut.closeEntry();
}
} finally {
jarOut.finish();
jarOut.flush();
closeOutput(out);
}
} catch (Exception ex) {
if (args.debug) {
DxConsole.err.println("\ntrouble writing output:");
ex.printStackTrace(DxConsole.err);
} else {
DxConsole.err.println("\ntrouble writing output: " +
ex.getMessage());
}
return false;
}
return true;
}
开发者ID:JLLK,项目名称:multidex-maker,代码行数:54,代码来源:Main.java
示例14: processFileBytes
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Processes one file, which may be either a class or a resource.
*
* @param name {@code non-null;} name of the file
* @param bytes {@code non-null;} contents of the file
* @return whether processing was successful
*/
private static boolean processFileBytes(String name, long lastModified, byte[] bytes) {
boolean isClass = name.endsWith(".class");
boolean isClassesDex = name.equals(DexFormat.DEX_IN_JAR_NAME);
boolean keepResources = (outputResources != null);
if (!isClass && !isClassesDex && !keepResources) {
if (args.verbose) {
DxConsole.out.println("ignored resource " + name);
}
return false;
}
if (args.verbose) {
DxConsole.out.println("processing " + name + "...");
}
String fixedName = fixPath(name);
if (isClass) {
if (keepResources && args.keepClassesInJar) {
synchronized (outputResources) {
outputResources.put(fixedName, bytes);
}
}
if (lastModified < minimumFileAge) {
return true;
}
return processClass(fixedName, bytes);
} else if (isClassesDex) {
synchronized (libraryDexBuffers) {
libraryDexBuffers.add(bytes);
}
return true;
} else {
synchronized (outputResources) {
outputResources.put(fixedName, bytes);
}
return true;
}
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:48,代码来源:Main.java
示例15: writeDex
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Converts {@link #outputDex} into a {@code byte[]} and do whatever
* human-oriented dumping is required.
*
* @return {@code null-ok;} the converted {@code byte[]} or {@code null}
* if there was a problem
*/
private static byte[] writeDex() {
byte[] outArray = null;
try {
OutputStream humanOutRaw = null;
OutputStreamWriter humanOut = null;
try {
if (args.humanOutName != null) {
humanOutRaw = openOutput(args.humanOutName);
humanOut = new OutputStreamWriter(humanOutRaw);
}
if (args.methodToDump != null) {
/*
* Simply dump the requested method. Note: The call
* to toDex() is required just to get the underlying
* structures ready.
*/
outputDex.toDex(null, false);
dumpMethod(outputDex, args.methodToDump, humanOut);
} else {
/*
* This is the usual case: Create an output .dex file,
* and write it, dump it, etc.
*/
outArray = outputDex.toDex(humanOut, args.verboseDump);
}
if (args.statistics) {
DxConsole.out.println(outputDex.getStatistics().toHuman());
}
} finally {
if (humanOut != null) {
humanOut.flush();
}
closeOutput(humanOutRaw);
}
} catch (Exception ex) {
if (args.debug) {
DxConsole.err.println("\ntrouble writing output:");
ex.printStackTrace(DxConsole.err);
} else {
DxConsole.err.println("\ntrouble writing output: " +
ex.getMessage());
}
return null;
}
return outArray;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:58,代码来源:Main.java
示例16: createJar
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Creates a jar file from the resources and given dex file array.
*
* @param fileName {@code non-null;} name of the file
* @param dexArray array containing the dex file to include, or null if the
* output contains no class defs.
* @return whether the creation was successful
*/
private static boolean createJar(String fileName, byte[] dexArray) {
/*
* Make or modify the manifest (as appropriate), put the dex
* array into the resources map, and then process the entire
* resources map in a uniform manner.
*/
try {
Manifest manifest = makeManifest();
OutputStream out = openOutput(fileName);
JarOutputStream jarOut = new JarOutputStream(out, manifest);
if (dexArray != null) {
outputResources.put(DexFormat.DEX_IN_JAR_NAME, dexArray);
}
try {
for (Map.Entry<String, byte[]> e :
outputResources.entrySet()) {
String name = e.getKey();
byte[] contents = e.getValue();
JarEntry entry = new JarEntry(name);
if (args.verbose) {
DxConsole.out.println("writing " + name + "; size " +
contents.length + "...");
}
entry.setSize(contents.length);
jarOut.putNextEntry(entry);
jarOut.write(contents);
jarOut.closeEntry();
}
} finally {
jarOut.finish();
jarOut.flush();
closeOutput(out);
}
} catch (Exception ex) {
if (args.debug) {
DxConsole.err.println("\ntrouble writing output:");
ex.printStackTrace(DxConsole.err);
} else {
DxConsole.err.println("\ntrouble writing output: " +
ex.getMessage());
}
return false;
}
return true;
}
开发者ID:AndreJCL,项目名称:JCL,代码行数:60,代码来源:Main.java
示例17: processFileBytes
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Processes one file, which may be either a class or a resource.
*
* @param name {@code non-null;} name of the file
* @param bytes {@code non-null;} contents of the file
* @return whether processing was successful
*/
private static boolean processFileBytes(String name, long lastModified, byte[] bytes) {
boolean isClass = name.endsWith(".class");
boolean isClassesDex = name.equals(DexFormat.DEX_IN_JAR_NAME);
boolean keepResources = (outputResources != null);
if (!isClass && !isClassesDex && !keepResources) {
if (args.verbose) {
DxConsole.out.println("ignored resource " + name);
}
return false;
}
if (args.verbose) {
DxConsole.out.println("processing " + name + "...");
}
String fixedName = fixPath(name);
if (isClass) {
if (keepResources && args.keepClassesInJar) {
synchronized (outputResources) {
outputResources.put(fixedName, bytes);
}
}
if (lastModified < minimumFileAge) {
return true;
}
processClass(fixedName, bytes);
// Assume that an exception may occur. Status will be updated
// asynchronously, if the class compiles without error.
return false;
} else if (isClassesDex) {
synchronized (libraryDexBuffers) {
libraryDexBuffers.add(bytes);
}
return true;
} else {
synchronized (outputResources) {
outputResources.put(fixedName, bytes);
}
return true;
}
}
开发者ID:johnlee175,项目名称:dex,代码行数:53,代码来源:Main.java
示例18: writeDex
import com.android.dx.command.DxConsole; //导入依赖的package包/类
/**
* Converts {@link #outputDex} into a {@code byte[]} and do whatever
* human-oriented dumping is required.
*
* @return {@code null-ok;} the converted {@code byte[]} or {@code null}
* if there was a problem
*/
private static byte[] writeDex(DexFile outputDex) {
byte[] outArray = null;
try {
try {
if (args.methodToDump != null) {
/*
* Simply dump the requested method. Note: The call
* to toDex() is required just to get the underlying
* structures ready.
*/
outputDex.toDex(null, false);
dumpMethod(outputDex, args.methodToDump, humanOutWriter);
} else {
/*
* This is the usual case: Create an output .dex file,
* and write it, dump it, etc.
*/
outArray = outputDex.toDex(humanOutWriter, args.verboseDump);
}
if (args.statistics) {
DxConsole.out.println(outputDex.getStatistics().toHuman());
}
} finally {
if (humanOutWriter != null) {
humanOutWriter.flush();
}
}
} catch (Exception ex) {
if (args.debug) {
DxConsole.err.println("\ntrouble writing output:");
ex.printStackTrace(DxConsole.err);
} else {
DxConsole.err.println("\ntrouble writing output: " +
ex.getMessage());
}
return null;
}
return outArray;
}
开发者ID:johnlee175,项目名称:dex,代码行数:49,代码来源:Main.java
示例19: onProcessArchiveStart
import com.android.dx.command.DxConsole; //导入依赖的package包/类
@Override
public void onProcessArchiveStart(File file) {
if (args.verbose) {
DxConsole.out.println("processing archive " + file + "...");
}
}
开发者ID:johnlee175,项目名称:dex,代码行数:7,代码来源:Main.java
注:本文中的com.android.dx.command.DxConsole类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论