/** * Set the input stream the tool should read from. If you don't set it, * it will default to STDIN. * * @param inputStream The input stream to use. */ public void setInputStream(InputStream inputStream) { if (null == mInputStream) { mInputStream = inputStream; } else { getPrintStream().println("Inputstream is already set."); } }
/** * Set the output print stream the tool should write to. If you don't set it, * it will default to STDOUT. * * @param printStream The output print stream to use. */ public void setPrintStream(PrintStream printStream) { if (null == mPrintStream) { mPrintStream = printStream; } else { getPrintStream().println("Printstream is already set."); } }
/** * Pretty print a tool error. * * @param toolError ToolError to pretty print. */ private void prettyPrintUserInputError( final ToolError toolError ) { if (mDebugFlag) { toolError.printStackTrace(getPrintStream()); } else { getPrintStream().println(toolError.getErrorMessage()); } }
/** Prints the tool usage message. */ private void printUsage() { final PrintStream ps = getPrintStream(); ps.println(getUsageString()); ps.println("Flags:"); FlagParser.printUsage(this, ps); }
/** * Checks with the user whether the specified operation may proceed. * * @param format String format with a question describing the operation about to be executed. * @param arguments String format arguments. * @return whether the operation may proceed, or not. * @throws IOException on I/O error. */ protected boolean mayProceed(String format, Object...arguments) throws IOException { if (!isInteractive()) { return true; } if (yesNoPrompt(String.format(format, arguments))) { return true; } getPrintStream().println("Aborted."); return false; }
try { while (yesOrNo == null) { getPrintStream().println(question); if (null != hint) { getPrintStream().println(hint);
getPrintStream().println(knie.getMessage()); getPrintStream().println("Try: fiji install --fiji=" + knie.getURI()); return FAILURE;