List of usage examples for java.io PrintStream print
public void print(Object obj)
From source file:avantssar.aslanpp.testing.HTMLHelper.java
public static void fileOrDash(PrintStream out, File root, File aslanPPfile, String prefix) { if (aslanPPfile != null) { out.print("<a href='"); out.print(removePrefix(root, aslanPPfile)); out.print("'>"); if (prefix != null) { out.print(prefix);/*from ww w .j a v a 2 s. c o m*/ } else { out.print(FilenameUtils.getBaseName(aslanPPfile.getName())); } out.print("</a>"); } else { if (prefix != null) { out.print(prefix); } else { out.print("-"); } } }
From source file:Main.java
/** * Whenever you'd need to print a configuration node and/or its children. * * @param root the root node to print.//ww w . ja v a 2 s. c o m * @param out the print stream that should be used to outpu * @param recurse boolean * @param prefix String */ public static void printChildElements(Element root, PrintStream out, boolean recurse, String prefix) { out.print(prefix + "<" + root.getNodeName()); NamedNodeMap attrs = root.getAttributes(); Node node; for (int i = 0; i < attrs.getLength(); i++) { node = attrs.item(i); out.print(" " + node.getNodeName() + "=\"" + node.getNodeValue() + "\""); } out.println(">"); String data = getText(root); if (data != null && data.trim().length() > 0) out.println(prefix + "\t" + data); data = getCData(root); if (data != null && data.trim().length() > 0) out.println(prefix + "\t<![CDATA[" + data + "]]>"); NodeList nodes = root.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { if (recurse) printChildElements((Element) node, out, recurse, prefix + "\t"); else out.println(prefix + node.getNodeName()); } } out.println(prefix + "</" + root.getNodeName() + ">"); }
From source file:org.apache.hadoop.hive.common.log.InPlaceUpdate.java
public static void rePositionCursor(PrintStream ps) { ps.print(ansi().cursorUp(0).toString()); ps.flush(); }
From source file:org.nuxeo.connect.tools.report.viewer.Viewer.java
public static PrintStream printThreadDump(ArrayNode infos, PrintStream out) throws IOException { StringBuilder sb = new StringBuilder(); new ThreadDumpPrinter(infos).print(sb); out.print(sb.toString()); return out;//from w w w . ja v a 2s .com }
From source file:avantssar.aslanpp.testing.Tester.java
private static void reportException(String message, Throwable e, PrintStream out) { out.print("Error: "); out.println(message);/*from w w w . j av a2 s . c o m*/ out.println(e.getMessage()); out.println(); Debug.logger.fatal(message, e); }
From source file:ShowHTMLViews.java
public static void displayElement(Document doc, Element e, int indent, PrintStream out) { for (int i = 0; i < indent; i++) { out.print(" "); }//from w ww. ja v a2 s. co m out.println("===== Element Class: " + getShortClassName(e.getClass())); for (int i = 0; i < indent; i++) { out.print(" "); } int startOffset = e.getStartOffset(); int endOffset = e.getEndOffset(); out.println("Offsets [" + startOffset + ", " + endOffset + "]"); AttributeSet a = e.getAttributes(); Enumeration x = a.getAttributeNames(); for (int i = 0; i < indent; i++) { out.print(" "); } out.println("ATTRIBUTES:"); while (x.hasMoreElements()) { for (int i = 0; i < indent; i++) { out.print(" "); } Object attr = x.nextElement(); out.println(" (" + attr + ", " + a.getAttribute(attr) + ")" + " [" + getShortClassName(attr.getClass()) + "/" + getShortClassName(a.getAttribute(attr).getClass()) + "] "); } // Display the text for a leaf element if (e.isLeaf()) { try { String str = doc.getText(startOffset, endOffset - startOffset); if (str.length() > 40) { str = str.substring(0, 40); } if (str.length() > 0) { for (int i = 0; i < indent; i++) { out.print(" "); } out.println("[" + str + "]"); } } catch (BadLocationException ex) { } } // Display child elements int count = e.getElementCount(); for (int i = 0; i < count; i++) { displayElement(doc, e.getElement(i), indent + 1, out); } }
From source file:org.apache.hadoop.hive.common.log.InPlaceUpdate.java
public static void reprintLine(PrintStream out, String line) { out.print(ansi().eraseLine(Ansi.Erase.ALL).a(line).a('\n').toString()); out.flush();//from www . ja va2s. c om }
From source file:com.azaptree.services.spring.application.SpringApplicationService.java
private static void logEnvironment(final Logger log) { if (log.isDebugEnabled()) { final TreeMap<String, String> sysProps = new TreeMap<>(System.getenv()); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final PrintStream ps = new PrintStream(bos); for (final Map.Entry<String, String> entry : sysProps.entrySet()) { ps.print(entry.getKey()); ps.print('='); ps.println(entry.getValue()); }/* w w w . j a v a 2s .co m*/ log.debug("Environment:\n{}", bos); } }
From source file:com.azaptree.services.spring.application.SpringApplicationService.java
private static void logDebugSystemProperties(final Logger log) { Assert.notNull(log);/*from www . j a v a2 s. co m*/ if (log.isDebugEnabled()) { final TreeMap<String, String> sysProps = new TreeMap<>(); for (final Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { sysProps.put(entry.getKey().toString(), entry.getValue().toString()); } final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final PrintStream ps = new PrintStream(bos); for (final Map.Entry<String, String> entry : sysProps.entrySet()) { ps.print(entry.getKey()); ps.print('='); ps.println(entry.getValue()); } log.debug("System Properties:\n{}", bos); } }
From source file:de.uni.bremen.monty.moco.Main.java
private static void writeOutput(String llvmCode, File outputFile) throws FileNotFoundException { PrintStream resultStream = new PrintStream(outputFile); resultStream.print(llvmCode); resultStream.close();//from w w w .j a v a 2s. c om }