List of usage examples for java.io PrintStream println
public void println(Object x)
From source file:com.hp.application.automation.tools.run.SvChangeModeBuilder.java
@Override protected void logConfig(PrintStream logger, String prefix) { super.logConfig(logger, prefix); logger.println(prefix + "Mode: " + model.getMode().toString()); logger.println(prefix + "Data model: " + model.getDataModel().toString()); logger.println(prefix + "Performance model: " + model.getPerformanceModel().toString()); }
From source file:com.tamingtext.tagrecommender.TestStackOverflowTagger.java
/** Dump the overall metrics */ public void dumpStats(PrintStream out, int postCount, int totalSingleCorrect, int totalHalfCorrect) { out.println("evaluated " + postCount + " posts; " + totalSingleCorrect + " with one correct tag, " + totalHalfCorrect + " with half correct"); out.print("\t %single correct: " + nf.format((totalSingleCorrect * 100) / (float) postCount)); out.println(", %half correct: " + nf.format((totalHalfCorrect * 100) / (float) postCount)); out.println();//w ww.jav a2 s . c o m out.flush(); }
From source file:jenkins.plugins.tanaguru.TanaguruRunner.java
/** * // www . j a va 2 s . c o m * @param logFile * @param ps * @throws IOException */ public void extractDataAndPrintOut(File logFile, PrintStream ps) throws IOException { ps.println(""); boolean isFirstMark = true; boolean isFirstNbPassed = true; boolean isFirstNbFailed = true; boolean isFirstNbFailedOccurences = true; boolean isFirstNbNmi = true; boolean isFirstNbNa = true; boolean isFirstNbNt = true; for (String line : FileUtils.readLines(logFile)) { if (StringUtils.startsWith(line, "Subject")) { ps.println(""); ps.println(line); } else if (StringUtils.startsWith(line, "Audit terminated")) { ps.println(line); } else if (StringUtils.startsWith(line, "RawMark")) { ps.println(line.replace("RawMark", "Mark")); if (isFirstMark) { mark = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).replaceAll("%", "") .trim(); isFirstMark = false; } } else if (StringUtils.startsWith(line, "Nb Passed")) { ps.println(line); if (isFirstNbPassed) { nbPassed = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); isFirstNbPassed = false; } } else if (StringUtils.startsWith(line, "Nb Failed test")) { ps.println(line); if (isFirstNbFailed) { nbFailed = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); isFirstNbFailed = false; } } else if (StringUtils.startsWith(line, "Nb Failed occurences")) { ps.println(line); if (isFirstNbFailedOccurences) { nbFailedOccurences = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); isFirstNbFailedOccurences = false; } } else if (StringUtils.startsWith(line, "Nb Pre-qualified")) { ps.println(line); if (isFirstNbNmi) { nbNmi = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); isFirstNbNmi = false; } } else if (StringUtils.startsWith(line, "Nb Not Applicable")) { ps.println(line); if (isFirstNbNa) { nbNa = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); isFirstNbNa = false; } } else if (StringUtils.startsWith(line, "Nb Not Tested")) { ps.println(line); if (isFirstNbNt) { nbNt = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); isFirstNbNt = false; } } else if (StringUtils.startsWith(line, "Audit Id")) { ps.println(line); auditId = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); } } ps.println(""); }
From source file:Main.java
public InputStream getWWWPageStream(String host, String file) throws IOException, UnknownHostException { InetAddress webServer = InetAddress.getByName(host); Socket httpPipe = new Socket(webServer, 80); if (httpPipe == null) { System.out.println("Socket to Web server creation failed."); return null; }//from ww w . j a v a2 s .com InputStream inn = httpPipe.getInputStream(); // get raw streams OutputStream outt = httpPipe.getOutputStream(); DataInputStream in = new DataInputStream(inn); // turn into higher-level ones PrintStream out = new PrintStream(outt); if (inn == null || outt == null) { System.out.println("Failed to open streams to socket."); return null; } out.println("GET " + file + " HTTP/1.0\n"); String response; while ((response = in.readUTF()).length() > 0) { System.out.println(response); } return in; }
From source file:GenericsTester.java
public void testTypeSafeReturnValues(PrintStream out) throws IOException { List<String> strings = getListOfStrings(); for (String s : strings) { out.println(s); }/* w w w . j a v a 2 s.c o m*/ }
From source file:edu.illinois.cs.cogcomp.lbjava.classify.TestReal.java
/** * Write to PrintStream, with statistical information * /* w ww . ja v a 2s . c o m*/ * @param out printstream * @param processed number of testing examples */ public void printPerformace(PrintStream out, int processed) { out.println("Statistical Metrics"); out.printf("Root Mean Squared Error: %f\n", getRootMeanSquaredError(processed)); out.printf("Mean Squared Error: %f\n", getMeanSquaredError(processed)); out.printf("Mean Absolute Error: %f\n", getMeanAbsoluteError(processed)); out.printf("Median Absolute Error: %f\n", getMedianAbsoluteError()); out.printf("Explained Variance: %f\n", getExplainedVariance()); out.printf("R2 Score: %f\n", getR2Score()); }
From source file:cc.wikitools.lucene.hadoop.FindWikipediaArticleIdHdfs.java
@SuppressWarnings("static-access") @Override/*from w w w . j a v a 2 s .c o m*/ public int run(String[] args) throws Exception { Options options = new Options(); options.addOption( OptionBuilder.withArgName("path").hasArg().withDescription("index location").create(INDEX_OPTION)); options.addOption( OptionBuilder.withArgName("string").hasArg().withDescription("article title").create(TITLE_OPTION)); CommandLine cmdline = null; CommandLineParser parser = new GnuParser(); try { cmdline = parser.parse(options, args); } catch (ParseException exp) { System.err.println("Error parsing command line: " + exp.getMessage()); System.exit(-1); } if (!cmdline.hasOption(TITLE_OPTION) || !cmdline.hasOption(INDEX_OPTION)) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(FindWikipediaArticleIdHdfs.class.getName(), options); System.exit(-1); } String indexLocation = cmdline.getOptionValue(INDEX_OPTION); String title = cmdline.getOptionValue(TITLE_OPTION); PrintStream out = new PrintStream(System.out, true, "UTF-8"); HdfsWikipediaSearcher searcher = new HdfsWikipediaSearcher(new Path(indexLocation), getConf()); int id = searcher.getArticleId(title); out.println(title + ": id = " + id); searcher.close(); out.close(); return 0; }
From source file:com.facebook.stetho.dumpapp.Dumper.java
private void dumpUsage(PrintStream output) { final String cmdName = "dumpapp"; HelpFormatter formatter = new HelpFormatter(); output.println("Usage: " + cmdName + " [options] <plugin> [plugin-options]"); PrintWriter writer = new PrintWriter(output); try {//from ww w. ja va 2s. c o m formatter.printOptions(writer, formatter.getWidth(), mGlobalOptions.options, formatter.getLeftPadding(), formatter.getDescPadding()); } finally { writer.flush(); } }
From source file:jenkins.plugins.asqatasun.AsqatasunRunner.java
/** * //from ww w .java 2 s.co m * @param logFile * @param ps * @throws IOException */ public void extractDataAndPrintOut(File logFile, PrintStream ps) throws IOException { ps.println(""); boolean isFirstMark = true; boolean isFirstNbPassed = true; boolean isFirstNbFailed = true; boolean isFirstNbFailedOccurences = true; boolean isFirstNbNmi = true; boolean isFirstNbNa = true; boolean isFirstNbNt = true; for (Object obj : FileUtils.readLines(logFile)) { String line = (String) obj; if (StringUtils.startsWith(line, "Subject")) { ps.println(""); ps.println(line); } else if (StringUtils.startsWith(line, "Audit terminated")) { ps.println(line); } else if (StringUtils.startsWith(line, "RawMark")) { ps.println(line.replace("RawMark", "Mark")); if (isFirstMark) { mark = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).replaceAll("%", "") .trim(); isFirstMark = false; } } else if (StringUtils.startsWith(line, "Nb Passed")) { nbPassed = getNbStatus(ps, isFirstNbPassed, line); isFirstNbPassed = false; } else if (StringUtils.startsWith(line, "Nb Failed test")) { nbFailed = getNbStatus(ps, isFirstNbFailed, line); isFirstNbFailed = false; } else if (StringUtils.startsWith(line, "Nb Failed occurences")) { nbFailedOccurences = getNbStatus(ps, isFirstNbFailedOccurences, line); isFirstNbFailedOccurences = false; } else if (StringUtils.startsWith(line, "Nb Pre-qualified")) { nbNmi = getNbStatus(ps, isFirstNbNmi, line); isFirstNbNmi = false; } else if (StringUtils.startsWith(line, "Nb Not Applicable")) { nbNa = getNbStatus(ps, isFirstNbNa, line); isFirstNbNa = false; } else if (StringUtils.startsWith(line, "Nb Not Tested")) { nbNt = getNbStatus(ps, isFirstNbNt, line); isFirstNbNt = false; } else if (StringUtils.startsWith(line, "Audit Id")) { ps.println(line); auditId = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); } } ps.println(""); }
From source file:com.nokia.ant.HeliumLogger.java
/** * {@inheritDoc}/* ww w. j av a 2s . c om*/ */ protected void printMessage(final String message, final PrintStream stream, final int priority) { if (!stopLogToConsole) { stream.println(message); } }