List of usage examples for java.io PrintStream print
public void print(Object obj)
From source file:org.echocat.jomon.runtime.logging.Slf4jUtils.java
@Nonnull private static Object createClToSlf4jLoggerFactoryFor(@Nullable ILoggerFactory loggerFactory) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, ClassNotFoundException {/* ww w. j a va2s. c o m*/ try { final Class<?> type = classLoader() .loadClass("org.echocat.jomon.runtime.logging.Cl2Slf4jLoggerFactory"); return type.getConstructor(ILoggerFactory.class).newInstance(loggerFactory); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { // noinspection UseOfSystemOutOrSystemErr final PrintStream stream = System.err; stream.print( "WARN Could not initiate instance of org.echocat.jomon.runtime.logging.Cl2Slf4jLoggerFactory."); e.printStackTrace(stream); throw e; } }
From source file:com.opengamma.analytics.financial.model.finitedifference.applications.PDEUtilityTools.java
public static void printSurface(final String name, final PDEFullResults1D res, final PrintStream out) { final int tNodes = res.getNumberTimeNodes(); final int xNodes = res.getNumberSpaceNodes(); out.println(name);/* www . java 2s . c o m*/ for (int i = 0; i < xNodes; i++) { final double k = res.getSpaceValue(i); out.print("\t" + k); } out.print("\n"); for (int j = 0; j < tNodes; j++) { final double t = res.getTimeValue(j); out.print(t); for (int i = 0; i < xNodes; i++) { out.print("\t" + res.getFunctionValue(i, j)); } out.print("\n"); } out.print("\n"); }
From source file:net.imagini.cassandra.DumpSSTables.SSTableExport.java
private static void createMapOutputs(Iterator<OnDiskAtom> columns, PrintStream out, AbstractType<?> comparator, CFMetaData cfMetaData, String key) { while (columns.hasNext()) { out.print(key + " "); // writeJSON(out, serializeColumn(columns.next(), comparator, // cfMetaData)); out.print(serializeColumn(columns.next(), comparator, cfMetaData)); out.println();/* w w w . j a v a 2 s.c o m*/ } }
From source file:it.units.malelab.ege.util.Utils.java
private static void printIndividualAncestry(Individual<?, ?, ?> individual, PrintStream ps, int pad) { for (int i = 0; i < pad; i++) { ps.print(" "); }/*w ww. j av a 2 s .c o m*/ ps.printf("'%20.20s' (%3d w/ %10.10s) f=%5.5s%n", individual.getPhenotype().leafNodes(), individual.getBirthDate(), individual.getFitness()); for (Individual<?, ?, ?> parent : individual.getParents()) { printIndividualAncestry(parent, ps, pad + 2); } }
From source file:org.apache.bookkeeper.tools.framework.CommandUtils.java
public static void printDescription(PrintStream printer, int firstLineIndent, int indent, String description) { int max = MAX_COLUMN_SIZE; String[] words = description.split(" "); int current = indent; int i = 0;// w w w . j a v a 2s. co m printIndent(printer, firstLineIndent); while (i < words.length) { String word = words[i]; if (word.length() > max || current + word.length() <= max) { if (i != 0) { printer.print(" "); } printer.print(word); current += (word.length() + 1); } else { printer.println(); printIndent(printer, indent); printer.print(word); current = indent; } i++; } printer.println(); }
From source file:hudson.plugins.clearcase.ClearCaseChangeLogSet.java
/** * Stores the history objects to the output stream as xml * /* www.j a v a 2s. co m*/ * @param outputStream the stream to write to * @param history the history objects to store * @throws IOException */ public static void saveToChangeLog(OutputStream outputStream, List<ClearCaseChangeLogEntry> history) throws IOException { PrintStream stream = new PrintStream(outputStream, false, "UTF-8"); int tagcount = ClearCaseChangeLogSet.TAGS.length; stream.println("<?xml version='1.0' encoding='UTF-8'?>"); stream.println("<history>"); for (ClearCaseChangeLogEntry entry : history) { stream.println("\t<entry>"); String[] strings = getEntryAsStrings(entry); for (int tag = 0; tag < tagcount; tag++) { stream.print("\t\t<"); stream.print(ClearCaseChangeLogSet.TAGS[tag]); stream.print('>'); stream.print(escapeForXml(strings[tag])); stream.print("</"); stream.print(ClearCaseChangeLogSet.TAGS[tag]); stream.println('>'); } for (ClearCaseChangeLogEntry.FileElement file : entry.getElements()) { stream.println("\t\t<element>"); stream.println("\t\t\t<file>"); stream.println(escapeForXml(file.getFile())); stream.println("\t\t\t</file>"); stream.println("\t\t\t<action>"); stream.println(escapeForXml(file.getAction())); stream.println("\t\t\t</action>"); stream.println("\t\t\t<version>"); stream.println(escapeForXml(file.getVersion())); stream.println("\t\t\t</version>"); stream.println("\t\t\t<operation>"); stream.println(escapeForXml(file.getOperation())); stream.println("\t\t\t</operation>"); stream.println("\t\t</element>"); } stream.println("\t</entry>"); } stream.println("</history>"); stream.close(); }
From source file:edu.utah.further.core.api.xml.XmlUtil.java
/** * @param xmlReader/*from w ww . j a va 2 s . c o m*/ * @param index */ private static void printNamespace(final PrintStream os, final XMLStreamReader xmlReader, final int index) { final String prefix = xmlReader.getNamespacePrefix(index); final String uri = xmlReader.getNamespaceURI(index); os.print(Strings.SPACE_STRING); if (StringUtils.isBlank(prefix)) { os.print("xmlns=" + quote(uri)); } else { os.print("xmlns:" + prefix + "=" + quote(uri)); } }
From source file:com.sangupta.jerry.print.ConsoleTableWriter.java
/** * Output the data of the table as a CSV * // w ww. ja v a 2s . c o m * @param table * the {@link ConsoleTable} to output * * @param out * the {@link PrintStream} to write to */ public static void writeCsv(ConsoleTable table, PrintStream out) { if (table == null) { throw new IllegalArgumentException("ConsoleTable cannot be null"); } if (out == null) { throw new IllegalArgumentException("PrintStream to write to cannot be null"); } final int columns = table.headerRow.numColumns(); if (table.headerRow != null) { for (int index = 0; index < columns; index++) { if (index > 0) { out.print(","); } out.print(table.headerRow.column(index)); } out.print("\n"); } // each row for (ConsoleTableRow row : table.rows) { for (int index = 0; index < columns; index++) { if (index > 0) { out.print(","); } out.print(row.column(index)); } out.print("\n"); } }
From source file:ie.aib.nbp.zosresttest.RunTest.java
private static void runServiceDiscovery(String username, String password, PrintStream out) { ZosRestServiceDiscoverer discoverer = new ZosRestServiceDiscoverer(config.getProperty("HOST"), Integer.parseInt(config.getProperty("PORT")), out); out.println("Discovering services ..."); out.println(""); JSONObject response = discoverer.getZosServices(config.getProperty("ZOSSERVICELIST"), username, password); if (response == null) { out.println("execution failed or hit the timeout !!!"); } else {/*from w w w. j a v a2 s.c om*/ JSONArray services = response.getJSONArray("zosConnectServices"); int i = 0; for (Object obj : services) { out.print(++i + ": "); JSONObject entry = (JSONObject) obj; out.println(entry); } } }
From source file:net.imagini.cassandra.DumpSSTables.SSTableExport.java
private static void serializeIColumns(Iterator<IColumn> columns, PrintStream out, AbstractType<?> comparator, CFMetaData cfMetaData) {//from w w w . j a v a 2 s . c o m while (columns.hasNext()) { writeJSON(out, serializeColumn(columns.next(), comparator, cfMetaData)); if (columns.hasNext()) out.print(", "); } }