List of usage examples for java.io PrintStream println
public void println(Object x)
From source file:com.facebook.stetho.dumpapp.Dumper.java
/** * Execute the dump method as if it were a fragile external command. Swallows exceptions * and translates them to dumped output text. * * @param input Input that came from the CLI's stdin. * @param out Output that will eventually make its way to the CLI's stdout. * @param err Output that will eventually make its way to the CLI's stderr. * @param args Argument list as passed from the CLI. * * @return Exit code as if this were a command-line invocation. *//* w w w. ja va 2s . com*/ public int dump(InputStream input, PrintStream out, PrintStream err, String[] args) { try { return doDump(input, out, err, args); } catch (ParseException e) { err.println(e.getMessage()); dumpUsage(err); return 1; } catch (DumpException e) { err.println(e.getMessage()); return 1; } catch (DumpappOutputBrokenException e) { // The peer is already gone, no sense in sending the exception stack to them. throw e; } catch (RuntimeException e) { e.printStackTrace(err); return 1; } }
From source file:jenkins.plugins.publish_over.BPPlugin.java
protected boolean isBuildGoodEnoughToRun(final AbstractBuild<?, ?> build, final PrintStream console) { if ((build.getResult() != null) && !build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) { console.println(consolePrefix + Messages.console_notPerforming(build.getResult())); return false; }// w w w. j ava2 s .com return true; }
From source file:com.linkedin.restli.tools.idlgen.TestRestLiResourceModelExporter.java
private void compareFiles(String actualFileName, String expectedFileName) throws Exception { String actualContent = readFile(actualFileName); String expectedContent = readFile(expectedFileName); if (!actualContent.trim().equals(expectedContent.trim())) { // Ugh... gradle PrintStream actualStdout = new PrintStream(new FileOutputStream(FileDescriptor.out)); actualStdout.println( "ERROR " + actualFileName + " does not match " + expectedFileName + " . Printing diff..."); try {/*from www . jav a 2 s . co m*/ // TODO environment dependent, not cross platform ProcessBuilder pb = new ProcessBuilder("diff", expectedFileName, actualFileName); pb.redirectErrorStream(); Process p = pb.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; while ((line = reader.readLine()) != null) { actualStdout.println(line); // System.out.println(line); } } catch (Exception e) { // TODO Setup log4j, find appropriate test harness used in R2D2 actualStdout.println("Error printing diff: " + e.getMessage()); } fail(actualFileName + " does not match " + expectedFileName); } }
From source file:com.github.vatbub.tictactoe.view.AnimationThreadPoolExecutor.java
private Runnable createEffectiveWaitingTask(Runnable task) { return () -> { // PrintStreams magically don't make the wait loop hang PrintStream nullStream = new PrintStream(new NullOutputStream()); while (isBlocked()) { nullStream.println("Waiting..."); }//from ww w.j a va 2s . c o m // run Platform.runLater(task); }; }
From source file:net.morphbank.mbsvc3.webservices.RestfulService.java
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Turn over work to RequestProcessor! response.setContentType("text/xml"); PrintStream out = new PrintStream(response.getOutputStream()); out.println("<html><body>Here I am</body></html>"); out.close();/*from w w w . ja v a 2 s .c om*/ }
From source file:ThreadTester.java
public void testBubbleSort(PrintStream out) throws IOException { Thread t1 = new BubbleSortThread(posArray); t1.start();/*from ww w. j a va 2s . c o m*/ out.println("Testing with postive numbers..."); // Wait for the thread to complete try { t1.join(); printArray(posArray, out); } catch (InterruptedException ignored) { } Thread t2 = new BubbleSortThread(negArray); t2.start(); out.println("Testing with negative numbers..."); try { t2.join(); printArray(negArray, out); } catch (InterruptedException ignored) { } }
From source file:hu.bme.mit.sette.ParserUI.java
public void run(BufferedReader in, PrintStream out) throws Exception { // directories File snippetProjectDir = parser.getSnippetProjectSettings().getBaseDirectory(); File runnerProjectDir = parser.getRunnerProjectSettings().getBaseDirectory(); out.println("Snippet project: " + snippetProjectDir); out.println("Runner project: " + runnerProjectDir); try {/* w ww. ja va 2 s . c o m*/ // TODO enhance this section parser.parse(); } catch (Exception e) { out.println("Parse failed: " + e.getMessage()); if (e instanceof ValidatorException) { throw (ValidatorException) e; } else { e.printStackTrace(); } } }
From source file:ca.nines.ise.cmd.Works.java
/** * {@inheritDoc}//from w w w . j a v a 2s .c o m */ @Override public void execute(CommandLine cmd) throws Exception { Corpus corpus; String root = "input"; Locale.setDefault(Locale.ENGLISH); PrintStream out = new PrintStream(System.out, true, "UTF-8"); if (cmd.hasOption("l")) { out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8"); } corpus = new Corpus(root); out.println(corpus); }
From source file:edu.msu.cme.rdp.classifier.train.validation.distance.PairwiseSeqDistance.java
public void printSummary(PrintStream outStream) { HashMap<String, ArrayList<Double>> rankDistanceMap = new HashMap<String, ArrayList<Double>>(); outStream.println("\nrank\ttaxonname\ttotalcount\tmean_distance\tstdev"); for (Taxonomy taxon : distanceMap.keySet()) { StdevCal.Std result = StdevCal.calStd(distanceMap.get(taxon)); outStream.println(taxon.getHierLevel() + "\t" + taxon.getName() + "\t" + result.getTotalCount() + "\t" + String.format("%.3f", result.getMean()) + "\t" + String.format("%.3f", result.getStdev())); ArrayList<Double> distList = rankDistanceMap.get(taxon.getHierLevel()); if (distList == null) { distList = new ArrayList<Double>(); distList.addAll(distanceMap.get(taxon)); rankDistanceMap.put(taxon.getHierLevel(), distList); } else {/*from w w w . j a va2 s. com*/ distList.addAll(distanceMap.get(taxon)); } } outStream.println("\nrank\ttotalcount\tmean_distance\tstdev"); for (String rank : rankDistanceMap.keySet()) { StdevCal.Std result = StdevCal.calStd(rankDistanceMap.get(rank)); outStream.println(rank + "\t" + result.getTotalCount() + "\t" + String.format("%.3f", result.getMean()) + "\t" + String.format("%.3f", result.getStdev())); } outStream.close(); }
From source file:halive.shootinoutside.common.core.game.map.GameMap.java
public void debugMapLayout(PrintStream out) { out.println("Map name: " + mapName); for (int x = 0; x < width; x++) { out.print("X: " + x + " "); for (int y = 0; y < height; y++) { out.print(tiles[x][y].getTileID() + " "); }//from ww w. j av a2s .co m out.print("\n"); } out.println("Texture Size " + textureSheet.length + " bytes"); }