List of usage examples for java.io PrintStream print
public void print(Object obj)
From source file:org.apache.orc.tools.json.JsonSchemaFinder.java
static void printType(PrintStream out, HiveType type, int margin) { if (type == null) { out.print("void"); } else if (type.kind.isPrimitive) { out.print(type.toString());//from w ww .j a v a 2 s. c om } else { switch (type.kind) { case STRUCT: out.println("struct <"); boolean first = true; for (Map.Entry<String, HiveType> field : ((StructType) type).fields.entrySet()) { if (!first) { out.println(","); } else { first = false; } for (int i = 0; i < margin; i++) { out.print(' '); } out.print(field.getKey()); out.print(": "); printType(out, field.getValue(), margin + INDENT); } out.print(">"); break; case LIST: out.print("array <"); printType(out, ((ListType) type).elementType, margin + INDENT); out.print(">"); break; case UNION: out.print("uniontype <"); first = true; for (HiveType child : ((UnionType) type).children) { if (!first) { out.print(','); } else { first = false; } printType(out, child, margin + INDENT); } out.print(">"); break; default: throw new IllegalArgumentException("Unknown kind " + type.kind); } } }
From source file:org.apache.nutch.ontology.jena.OntologyImpl.java
protected static void renderURI(PrintStream out, PrefixMapping prefixes, String uri) { out.print(prefixes.usePrefix(uri)); }
From source file:org.apache.mahout.utils.MatrixDumper.java
private static void exportCSV(Path inputPath, String outputFile, boolean doLabels) throws IOException { SequenceFileValueIterator<MatrixWritable> it = new SequenceFileValueIterator<>(inputPath, true, new Configuration()); Matrix m = it.next().get();/*from w w w .j av a 2 s . com*/ it.close(); PrintStream ps = getPrintStream(outputFile); String[] columnLabels = getLabels(m.numCols(), m.getColumnLabelBindings(), "col"); String[] rowLabels = getLabels(m.numRows(), m.getRowLabelBindings(), "row"); if (doLabels) { ps.print("rowid,"); ps.print(columnLabels[0]); for (int c = 1; c < m.numCols(); c++) { ps.print(',' + columnLabels[c]); } ps.println(); } for (int r = 0; r < m.numRows(); r++) { if (doLabels) { ps.print(rowLabels[0] + ','); } ps.print(Double.toString(m.getQuick(r, 0))); for (int c = 1; c < m.numCols(); c++) { ps.print(","); ps.print(Double.toString(m.getQuick(r, c))); } ps.println(); } if (ps != System.out) { ps.close(); } }
From source file:au.com.jwatmuff.eventmanager.export.CSVExporter.java
public static void generateResults(Database database, ResultInfoCache cache, OutputStream out) { PrintStream ps = new PrintStream(out); for (Result result : database.findAll(Result.class, ResultDAO.ALL)) { try {/*w ww. j a va 2s . c o m*/ ResultInfo ri = cache.getResultInfo(result.getID()); ps.print("\"" + ri.getMatName() + "\","); ps.print(ri.getMatFightNumber() + ","); ps.print("\"" + ri.getPlayerName()[0] + "\","); ps.print("\"" + ri.getPlayerName()[1] + "\","); ps.print(ri.getResult().getScores()[0] + ","); ps.print(ri.getResult().getScores()[1]); ps.println(); } catch (DatabaseStateException e) { // do nothing } } }
From source file:org.apache.openejb.assembler.classic.cmd.Info2Properties.java
private static void println(final PrintStream out, final String cr, final String text) { out.print(text.replace("\n", cr) + cr); out.flush();//ww w .j a v a2 s .c om }
From source file:fr.in2p3.maven.plugin.DependencyXmlMojo.java
private static void indent(DependencyNode current, PrintStream out) { for (int i = 0; i < current.getDepth(); i++) { out.print(" "); }/*w w w. j a v a 2 s .c o m*/ }
From source file:org.apache.bookkeeper.tools.framework.CommandUtils.java
private static void printFlag(ParameterDescription pd, int indent, PrintStream printer) { WrappedParameter parameter = pd.getParameter(); // print flag printIndent(printer, indent);//from ww w . j av a2 s .c om printer.print(pd.getNames()); printer.print(parameter.required() ? " (*)" : ""); printer.println(); // print flag description int descIndent = 2 * indent; printDescription(printer, descIndent, descIndent, pd.getDescription()); }
From source file:com.aptana.core.epl.downloader.RepositoryStatusHelper.java
private static void appendLevelString(PrintStream strm, int level) { if (level > 0) { strm.print("[0"); //$NON-NLS-1$ for (int idx = 1; idx < level; ++idx) { strm.print('.'); strm.print(level);/*from w w w . j a va 2 s.co m*/ } strm.print(']'); } }
From source file:org.apache.myfaces.util.DebugUtils.java
private static void printIndent(PrintStream stream, int depth) { for (int i = 0; i < depth; i++) { stream.print(" "); }/*from w ww .j a v a 2 s .c o m*/ }
From source file:esiptestbed.mudrod.ontology.process.LocalOntology.java
protected static void renderURI(PrintStream out, PrefixMapping prefixes, String uri) { out.print(prefixes.expandPrefix(uri)); }