List of usage examples for java.io PrintStream println
public void println(Object x)
From source file:com.ripariandata.timberwolf.conf4j.ConfigFileParser.java
/** * Prints usage information for the config entries to the given stream. * Wraps usage information to 80 characters wide. * <p>// www .j a v a 2 s .c om * Example output: * <pre> * my.property - This is how to use this property. * * longer.property.name - All the hyphens line up. * * long.usage - Long usage descriptions will wrap at 80 characters wide * and remain lined up like this. * </pre> */ public void printUsage(final PrintStream out) { out.println("Valid properties in the configuration file:"); int longestNameLength = 0; for (ConfigEntry entry : entries) { if (entry.name().length() > longestNameLength) { longestNameLength = entry.name().length(); } } for (ConfigEntry entry : entries) { out.print(entry.name()); out.print(ofChars(' ', longestNameLength - entry.name().length())); String separator = " - "; out.print(separator); out.println(splitAndPad(entry.usage(), DEFAULT_OUTPUT_WIDTH, DEFAULT_OUTPUT_WIDTH - longestNameLength - separator.length())); } }
From source file:edu.umn.cs.spatialHadoop.core.RectangleNN.java
public static long spatialJoinLocal(Path[] inFiles, Path outFile, OperationsParams params) throws IOException, InterruptedException { // Read the inputs and store them in memory List<Shape>[] datasets = new List[inFiles.length]; final SpatialInputFormat3<Rectangle, Shape> inputFormat = new SpatialInputFormat3<Rectangle, Shape>(); for (int i = 0; i < inFiles.length; i++) { datasets[i] = new ArrayList<Shape>(); FileSystem inFs = inFiles[i].getFileSystem(params); Job job = Job.getInstance(params); SpatialInputFormat3.addInputPath(job, inFiles[i]); for (InputSplit split : inputFormat.getSplits(job)) { FileSplit fsplit = (FileSplit) split; RecordReader<Rectangle, Iterable<Shape>> reader = inputFormat.createRecordReader(fsplit, null); if (reader instanceof SpatialRecordReader3) { ((SpatialRecordReader3) reader).initialize(fsplit, params); } else if (reader instanceof RTreeRecordReader3) { ((RTreeRecordReader3) reader).initialize(fsplit, params); } else if (reader instanceof HDFRecordReader) { ((HDFRecordReader) reader).initialize(fsplit, params); } else { throw new RuntimeException("Unknown record reader"); }//from w ww . j a v a2 s. c om while (reader.nextKeyValue()) { Iterable<Shape> shapes = reader.getCurrentValue(); for (Shape shape : shapes) { datasets[i].add(shape.clone()); } } reader.close(); } } // Apply the spatial join algorithm ResultCollector2<Shape, Shape> output = null; PrintStream out = null; if (outFile != null) { FileSystem outFS = outFile.getFileSystem(params); out = new PrintStream(outFS.create(outFile)); final PrintStream outout = out; output = new ResultCollector2<Shape, Shape>() { @Override public void collect(Shape r, Shape s) { outout.println(r.toText(new Text()) + "," + s.toText(new Text())); } }; } long resultCount = SpatialJoin_planeSweep(datasets[0], datasets[1], output, null); if (out != null) out.close(); return resultCount; }
From source file:com.kelveden.rastajax.servlet.DefaultHtmlServlet.java
private void writeRepresentationToResponse(Set<FlatResource> representation, HttpServletResponse httpResponse) throws IOException { httpResponse.setContentType("text/html; charset=utf8"); final OutputStream outputStream = httpResponse.getOutputStream(); final PrintStream printStream = new PrintStream(outputStream); printStream.println("<html>"); printStream.println("<body>"); printStream.println("<head>"); printStream.println("<style type=\"text/css\">"); printStream.println("* { font-size:10px; }"); printStream.println("table { border-width: 1px; border-collapse: collapse; margin-left: 10px; }"); printStream.println("table th { border: 1px solid; padding: 4px; background-color: #dedede; }"); printStream.println("table td { border: 1px solid; padding: 4px; }"); printStream.println("</style>"); printStream.println("</head>"); for (FlatResource resource : representation) { writeResource(resource, printStream); }/*from w ww . j a v a 2s . co m*/ printStream.println("</body>"); printStream.println("</html>"); printStream.flush(); }
From source file:edu.oregonstate.eecs.mcplan.experiments.PolicyComparison.java
@Override public void finish() { try {//from w w w . j av a 2 s .com final PrintStream rout = new PrintStream(new File(env_.root_directory, "result.csv")); rout.println("key,value"); rout.println("winner," + end_state.win); rout.println("score," + end_state.score); rout.close(); } catch (final FileNotFoundException ex) { throw new RuntimeException(ex); } }
From source file:net.imagini.cassandra.DumpSSTables.SSTableExport.java
/** * Get portion of the columns and serialize in loop while not more columns * left in the row//from ww w. jav a2 s. c o m * * @param row * SSTableIdentityIterator row representation with Column Family * @param key * Decorated Key for the required row * @param out * output stream * @throws CharacterCodingException */ private static void serializeRow(SSTableIdentityIterator row, DecoratedKey key, PrintStream out) throws CharacterCodingException { ColumnFamily columnFamily = row.getColumnFamily(); boolean isSuperCF = columnFamily.isSuper(); CFMetaData cfMetaData = columnFamily.metadata(); AbstractType<?> comparator = columnFamily.getComparator(); // out.println("{"); // writeKey(out, "key"); // writeJSON(out, ByteBufferUtil.string(key.key)); // out.print(ByteBufferUtil.string(key.key)); // out.print(":"); out.print(ByteBufferUtil.string(key.key) + " "); writeKey(out, "metadata"); writeMeta(out, columnFamily); // writeKey(out, "columns"); if (isSuperCF) { out.println("WARNING: SUPERCOLUMN"); throw new UnsupportedOperationException("This program does not support supercolumns"); } out.println(); // serializeColumns(row, out, comparator, cfMetaData); createMapOutputs(row, out, comparator, cfMetaData, ByteBufferUtil.string(key.key)); }
From source file:eu.europa.ec.fisheries.uvms.plugins.inmarsat.twostage.Connect.java
private void write(String value, PrintStream out) throws IOException { out.println(value); out.flush();//from w w w. j a v a 2s.c o m LOG.debug("write:" + value); }
From source file:li.klass.fhem.fhem.TelnetConnection.java
private void writeCommand(PrintStream printStream, String command) { printStream.println(command); printStream.flush(); }
From source file:net.praqma.jenkins.plugin.prqa.QAFrameworkRemoteReport.java
@Override public PRQAComplianceStatus invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { Map<String, String> expandedEnvironment = expandEnvironment(report.getEnvironment(), report.getAppSettings(), report.getSettings()); report.setEnvironment(expandedEnvironment); report.setWorkspace(f);//from ww w .ja v a 2 s . c o m PrintStream out = listener.getLogger(); out.println("Workspace from invoke:" + f.getAbsolutePath()); /** * If the project file is null at this point. It means that this is a * report based on a settings file. * * We skip the analysis phase */ try { if (StringUtils.isBlank(report.getSettings().getQaInstallation())) { throw new PrqaException("Incorrect configuration!"); } if (reportSetting.isPullUnifiedProject()) { CmdResult pullUnifyProject = report.pullUnifyProjectQacli(isUnix, out); logCmdResult(pullUnifyProject, out); } CmdResult analyzeResult = report.analyzeQacli(isUnix, "-cf", out); logCmdResult(analyzeResult, out); if (reportSetting.isQaCrossModuleAnalysis()) { CmdResult cmaAnalysisResult = report.cmaAnalysisQacli(isUnix, out); logCmdResult(cmaAnalysisResult, out); } if (reportSetting.isGenCrReport()) { String Report = "CRR"; CmdResult crrGenerationResult = report.reportQacli(isUnix, Report, out); logCmdResult(crrGenerationResult, out); } if (reportSetting.isGenMdReport()) { String Report = "MDR"; CmdResult mdrGenerationResult = report.reportQacli(isUnix, Report, out); logCmdResult(mdrGenerationResult, out); } if (reportSetting.isGenSupReport()) { String Report = "SUR"; CmdResult srGenerationResult = report.reportQacli(isUnix, Report, out); logCmdResult(srGenerationResult, out); } String Report = "RCR"; CmdResult rcrGenerationResult = report.reportQacli(isUnix, Report, out); logCmdResult(rcrGenerationResult, out); return report.getComplianceStatus(out); } catch (PrqaException exception) { throw new IOException(exception.getMessage(), exception); } catch (Exception ex) { throw new IOException(ex.getMessage()); } }
From source file:com.kylinolap.dict.DateStrDictionary.java
@Override public void dump(PrintStream out) { out.println(this.toString()); }
From source file:com.openkm.servlet.admin.UnitTestingServlet.java
/** * Print HTML page header//from w w w . j a va2s . c om */ private void header(PrintStream out, String title, String[][] breadcrumb) { out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); out.println( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); out.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); out.println("<head>"); out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"); out.println("<link rel=\"Shortcut icon\" href=\"favicon.ico\" />"); out.println("<link rel=\"stylesheet\" href=\"css/style.css\" type=\"text/css\" />"); out.println("<title>" + title + "</title>"); out.println("</head>"); out.println("<body>"); out.println("<ul id=\"breadcrumb\">"); for (String[] elto : breadcrumb) { out.println("<li class=\"path\">"); out.print("<a href=\"" + elto[0] + "\">" + elto[1] + "</a>"); out.print("</li>"); } out.println("<li class=\"path\">" + title + "</li>"); out.println("</ul>"); out.println("<br/>"); }