本文整理汇总了Java中com.facebook.stetho.dumpapp.DumpUsageException类的典型用法代码示例。如果您正苦于以下问题:Java DumpUsageException类的具体用法?Java DumpUsageException怎么用?Java DumpUsageException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DumpUsageException类属于com.facebook.stetho.dumpapp包,在下文中一共展示了DumpUsageException类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
/**
* Entry point for the Stetho dumpapp script.
*
* {@link #initialize} must have been called in the app before running dumpapp.
*/
@Override
public void dump(DumperContext dumpContext) throws DumpException {
ensureInitialized();
List<String> args = dumpContext.getArgsAsList();
PrintStream writer = dumpContext.getStdout();
String cmd = args.isEmpty() ? null : args.get(0);
List<String> rest = args.isEmpty() ? new ArrayList<String>() : args.subList(1, args.size());
if (cmd != null && cmd.equals("memcache")) {
memcache(writer, rest);
} else if (cmd != null && cmd.equals("diskcache")) {
diskcache(mMainFileCache, "Main", writer, rest);
diskcache(mSmallFileCache, "Small", writer, rest);
} else {
usage(writer);
if (TextUtils.isEmpty(cmd)) {
throw new DumpUsageException("Missing command");
} else {
throw new DumpUsageException("Unknown command: " + cmd);
}
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:BaseFrescoStethoPlugin.java
示例2: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Override
public void dump(DumperContext dumpContext) throws DumpException {
Iterator<String> argsIter = dumpContext.getArgsAsList().iterator();
String command = ArgsHelper.nextOptionalArg(argsIter, null);
if ("throw".equals(command)) {
doUncaughtException(argsIter);
} else if ("kill".equals(command)) {
doKill(dumpContext, argsIter);
} else if ("exit".equals(command)) {
doSystemExit(argsIter);
} else {
doUsage(dumpContext.getStdout());
if (command != null) {
throw new DumpUsageException("Unsupported command: " + command);
}
}
}
开发者ID:facebook,项目名称:stetho,代码行数:19,代码来源:CrashDumperPlugin.java
示例3: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Override
public void dump(DumperContext dumpContext) throws DumpException {
Iterator<String> args = dumpContext.getArgsAsList().iterator();
String command = ArgsHelper.nextOptionalArg(args, "");
if ("ls".equals(command)) {
doLs(dumpContext.getStdout());
} else if ("tree".equals(command)) {
doTree(dumpContext.getStdout());
} else if ("download".equals(command)) {
doDownload(dumpContext.getStdout(), args);
} else {
doUsage(dumpContext.getStdout());
if (!"".equals(command)) {
throw new DumpUsageException("Unknown command: " + command);
}
}
}
开发者ID:facebook,项目名称:stetho,代码行数:19,代码来源:FilesDumperPlugin.java
示例4: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Override
public void dump(DumperContext dumpContext) throws DumpException {
PrintStream writer = dumpContext.getStdout();
Iterator<String> argsIter = dumpContext.getArgsAsList().iterator();
String command = ArgsHelper.nextOptionalArg(argsIter, null);
if (CMD_LIST.equalsIgnoreCase(command)) {
doList(writer);
} else if (CMD_DELETE.equalsIgnoreCase(command)) {
doRemove(writer, argsIter);
} else if (CMD_CLEAR.equalsIgnoreCase(command)) {
doClear(writer);
} else if (CMD_REFRESH.equalsIgnoreCase(command)) {
doRefresh(writer);
} else {
usage(writer);
if (command != null) {
throw new DumpUsageException("Unknown command: " + command);
}
}
}
开发者ID:facebook,项目名称:stetho,代码行数:23,代码来源:APODDumperPlugin.java
示例5: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Override
public void dump(DumperContext dumpContext) throws DumpException {
PrintStream writer = dumpContext.getStdout();
Iterator<String> argsIter = dumpContext.getArgsAsList().iterator();
String command = ArgsHelper.nextOptionalArg(argsIter, null);
if (CMD_LIST.equalsIgnoreCase(command)) {
doList(writer);
} else if (CMD_DELETE.equalsIgnoreCase(command)) {
doRemove(writer, argsIter);
} else if (CMD_CLEAR.equalsIgnoreCase(command)) {
doClear(writer);
} else if (CMD_REFRESH.equalsIgnoreCase(command)) {
doRefresh(writer);
} else {
usage(writer);
if (command != null) {
throw new DumpUsageException("Unknown command: " + command);
}
}
}
开发者ID:BruceHurrican,项目名称:asstudydemo,代码行数:23,代码来源:APODDumperPlugin.java
示例6: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Override
public void dump(DumperContext dumpContext) throws DumpException {
Iterator<String> args = dumpContext.getArgsAsList().iterator();
String command = ArgsHelper.nextOptionalArg(args, "");
if ("download".equals(command)) {
doDownload(dumpContext.getStdout(), args);
} else {
doUsage(dumpContext.getStdout());
if (!"".equals(command)) {
throw new DumpUsageException("Unknown command: " + command);
}
}
}
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:15,代码来源:RongDbFilesDumperPlugin.java
示例7: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Override
public void dump(DumperContext dumpContext) throws DumpUsageException {
PrintStream writer = dumpContext.getStdout();
List<String> args = dumpContext.getArgsAsList();
String commandName = args.isEmpty() ? "" : args.remove(0);
if (commandName.equals("print")) {
doPrint(writer, args);
} else if (commandName.equals("write")) {
doWrite(args);
} else {
doUsage(writer);
}
}
开发者ID:facebook,项目名称:stetho,代码行数:16,代码来源:SharedPreferencesDumperPlugin.java
示例8: nextArg
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Nonnull
private static String nextArg(Iterator<String> iter, String messageIfNotPresent)
throws DumpUsageException {
if (!iter.hasNext()) {
throw new DumpUsageException(messageIfNotPresent);
}
return iter.next();
}
开发者ID:facebook,项目名称:stetho,代码行数:9,代码来源:SharedPreferencesDumperPlugin.java
示例9: usage
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
private void usage(PrintStream output) throws DumpUsageException {
output.println("Usage: dumpapp hprof [ path ]");
output.println("Dump HPROF memory usage data from the running application.");
output.println();
output.println("Where path can be any of:");
output.println(" - Output directly to stdout");
output.println(" <path> Full path to a writable file on the device");
output.println(" <filename> Relative filename that will be stored in the app internal storage");
throw new DumpUsageException("Missing path");
}
开发者ID:facebook,项目名称:stetho,代码行数:11,代码来源:HprofDumperPlugin.java
示例10: doHello
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
private void doHello(InputStream in, PrintStream writer, String name) throws DumpException {
if (TextUtils.isEmpty(name)) {
// This will print an error to the dumpapp user and cause a non-zero exit of the
// script.
throw new DumpUsageException("Name is empty");
} else if ("-".equals(name)) {
try {
name = new BufferedReader(new InputStreamReader(in)).readLine();
} catch (IOException e) {
throw new DumpException(e.toString());
}
}
writer.println("Hello " + name + "!");
}
开发者ID:facebook,项目名称:stetho,代码行数:16,代码来源:HelloWorldDumperPlugin.java
示例11: doHello
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
private void doHello(InputStream in, PrintStream writer, String name) throws DumpException {
if (TextUtils.isEmpty(name)) {
// This will print an error to the dumpapp user and cause a non-zero exit of the
// script.
throw new DumpUsageException("Name is empty");
} else if ("-".equals(name)) {
try {
name = new BufferedReader(new InputStreamReader(in)).readLine();
} catch (IOException e) {
throw new DumpException(e.toString());
}
}
writer.println("Hello " + name + "!");
}
开发者ID:BruceHurrican,项目名称:asstudydemo,代码行数:16,代码来源:HelloWorldDumperPlugin.java
示例12: doWrite
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
/**
* Executes command to update one value in the shared preferences
*/
// We explicitly want commit() so that the dumper blocks while the write occurs.
@SuppressLint("CommitPrefEdits")
private void doWrite(List<String> args) throws DumpUsageException {
String usagePrefix = "Usage: prefs write <path> <key> <type> <value>, where type is one of: ";
Iterator<String> argsIter = args.iterator();
String path = nextArg(argsIter, "Expected <path>");
String key = nextArg(argsIter, "Expected <key>");
String typeName = nextArg(argsIter, "Expected <type>");
Type type = Type.of(typeName);
if (type == null) {
throw new DumpUsageException(
Type.appendNamesList(new StringBuilder(usagePrefix), ", ").toString());
}
SharedPreferences sharedPreferences = getSharedPreferences(path);
SharedPreferences.Editor editor = sharedPreferences.edit();
switch (type) {
case BOOLEAN:
editor.putBoolean(key, Boolean.valueOf(nextArgValue(argsIter)));
break;
case INT:
editor.putInt(key, Integer.valueOf(nextArgValue(argsIter)));
break;
case LONG:
editor.putLong(key, Long.valueOf(nextArgValue(argsIter)));
break;
case FLOAT:
editor.putFloat(key, Float.valueOf(nextArgValue(argsIter)));
break;
case STRING:
editor.putString(key, nextArgValue(argsIter));
break;
case SET:
putStringSet(editor, key, argsIter);
break;
}
editor.commit();
}
开发者ID:facebook,项目名称:stetho,代码行数:46,代码来源:SharedPreferencesDumperPlugin.java
示例13: nextArgValue
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Nonnull
private static String nextArgValue(Iterator<String> iter) throws DumpUsageException {
return nextArg(iter, "Expected <value>");
}
开发者ID:facebook,项目名称:stetho,代码行数:5,代码来源:SharedPreferencesDumperPlugin.java
示例14: doLs
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
private void doLs(PrintStream writer) throws DumpUsageException {
File baseDir = getBaseDir(mContext);
if (baseDir.isDirectory()) {
printDirectoryText(baseDir, "", writer);
}
}
开发者ID:facebook,项目名称:stetho,代码行数:7,代码来源:FilesDumperPlugin.java
示例15: doTree
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
private void doTree(PrintStream writer) throws DumpUsageException {
File baseDir = getBaseDir(mContext);
printDirectoryVisual(baseDir, 0, writer);
}
开发者ID:facebook,项目名称:stetho,代码行数:5,代码来源:FilesDumperPlugin.java
示例16: doRemove
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
private void doRemove(PrintStream writer, Iterator<String> argsIter) throws DumpUsageException {
String rowId = ArgsHelper.nextArg(argsIter, "Expected rowId");
delete(writer, APODContract.Columns._ID + "=?", new String[] {rowId});
}
开发者ID:facebook,项目名称:stetho,代码行数:6,代码来源:APODDumperPlugin.java
示例17: dump
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
@Override
public void dump(DumperContext dumperContext) throws DumpException {
Iterator<String> argsIterator = dumperContext.getArgsAsList().iterator();
String command = ArgsHelper.nextOptionalArg(argsIterator, null);
mIsAll = false;
if (CMD_BUILD_CONFIG.equalsIgnoreCase(command)) {
dumpBuildConfig(dumperContext);
} else if (CMD_PERMISSION.equalsIgnoreCase(command)) {
dumpPermission(dumperContext);
} else if (CMD_LAST_UPDATE.equalsIgnoreCase(command)) {
dumpLastUpdate(dumperContext);
} else if (CMD_APPLICATION_INFO.equalsIgnoreCase(command)) {
dumpApplicationInfo(dumperContext);
} else if (CMD_ID.equalsIgnoreCase(command)) {
dumpIds(dumperContext);
} else if (CMD_OS_BUILD.equalsIgnoreCase(command)) {
dumpOsBuild(dumperContext);
} else if (CMD_DPI.equalsIgnoreCase(command)) {
dumpDpi(dumperContext);
} else if (CMD_MEMORY.equalsIgnoreCase(command)) {
dumpMemory(dumperContext);
} else if (CMD_ERROR.equalsIgnoreCase(command)) {
dumpError(dumperContext);
} else if (CMD_NETWORK.equalsIgnoreCase(command)) {
dumpNetwork(dumperContext);
} else if (CMD_TEL.equalsIgnoreCase(command)) {
dumpTel(dumperContext);
} else if (CMD_ALL.equalsIgnoreCase(command)) {
mIsAll = true;
dumpBuildConfig(dumperContext);
dumpPermission(dumperContext);
dumpLastUpdate(dumperContext);
dumpApplicationInfo(dumperContext);
dumpIds(dumperContext);
dumpOsBuild(dumperContext);
dumpDpi(dumperContext);
dumpMemory(dumperContext);
dumpError(dumperContext);
dumpNetwork(dumperContext);
dumpTel(dumperContext);
} else {
usage(dumperContext);
if (command != null) {
throw new DumpUsageException("Unknown command: " + command);
}
}
}
开发者ID:shikato,项目名称:info-dumper,代码行数:51,代码来源:InfoDumperPlugin.java
示例18: doRemove
import com.facebook.stetho.dumpapp.DumpUsageException; //导入依赖的package包/类
private void doRemove(PrintStream writer, Iterator<String> argsIter) throws DumpUsageException {
String rowId = ArgsHelper.nextArg(argsIter, "Expected rowId");
delete(writer, APODContract.Columns._ID + "=?", new String[]{rowId});
}
开发者ID:BruceHurrican,项目名称:asstudydemo,代码行数:6,代码来源:APODDumperPlugin.java
注:本文中的com.facebook.stetho.dumpapp.DumpUsageException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论