Java Code Examples for com.facebook.stetho.dumpapp.DumperContext#getStdout()
The following examples show how to use
com.facebook.stetho.dumpapp.DumperContext#getStdout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HprofDumperPlugin.java From stetho with MIT License | 6 votes |
@Override public void dump(DumperContext dumpContext) throws DumpException { final PrintStream output = dumpContext.getStdout(); Iterator<String> argsIter = dumpContext.getArgsAsList().iterator(); String outputPath = argsIter.hasNext() ? argsIter.next() : null; if (outputPath == null) { usage(output); } else { if ("-".equals(outputPath)) { handlePipeOutput(output); } else { File outputFile = new File(outputPath); if (!outputFile.isAbsolute()) { outputFile = mContext.getFileStreamPath(outputPath); } writeHprof(outputFile); output.println("Wrote to " + outputFile); } } }
Example 2
Source File: APODDumperPlugin.java From stetho with MIT License | 6 votes |
@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); } } }
Example 3
Source File: BaseFrescoStethoPlugin.java From fresco with MIT License | 6 votes |
/** * Entry point for the Stetho dumpapp script. * * <p>{@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 if (cmd != null && cmd.equals("clear")) { mImagePipeline.clearCaches(); } else { usage(writer); if (TextUtils.isEmpty(cmd)) { throw new DumpUsageException("Missing command"); } else { throw new DumpUsageException("Unknown command: " + cmd); } } }
Example 4
Source File: AppDumperPlugin.java From droidconat-2016 with Apache License 2.0 | 5 votes |
@Override public void dump(DumperContext dumpContext) throws DumpException { final PrintStream writer = dumpContext.getStdout(); List<String> args = dumpContext.getArgsAsList(); String commandName = args.isEmpty() ? "" : args.remove(0); switch (commandName) { case "alarms": displayAlarms(writer); break; case "appInfo": displayAppInfo(writer); break; case "bootReceiver": displayBootReceiverState(writer); break; case "currentSession": displayCurrentSessionData(writer); break; case "endpoint": changeEndpoint(writer, args); break; case "notif": displayNotificationReminder(); break; default: doUsage(writer); break; } }
Example 5
Source File: SharedPreferencesDumperPlugin.java From stetho with MIT License | 5 votes |
@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); } }
Example 6
Source File: HelloWorldDumperPlugin.java From stetho with MIT License | 5 votes |
@Override public void dump(DumperContext dumpContext) throws DumpException { PrintStream writer = dumpContext.getStdout(); Iterator<String> args = dumpContext.getArgsAsList().iterator(); String helloToWhom = ArgsHelper.nextOptionalArg(args, null); if (helloToWhom != null) { doHello(dumpContext.getStdin(), writer, helloToWhom); } else { doUsage(writer); } }