List of usage examples for java.io PrintStream print
public void print(Object obj)
From source file:com.netflix.hollow.jsonadapter.util.JsonUtil.java
private static void print(int index, String value, PrintStream out) { for (int i = 0; i < index; i++) { out.print("\t"); }/*from ww w.ja v a 2 s . co m*/ out.println(value); }
From source file:TextComponentDisplay.java
public static void displayView(View view, int tabs, PrintStream out) { // Print info about this view for (int i = 0; i < tabs; i++) { out.print("\t"); }/*from w ww . ja va 2 s . c o m*/ out.println(view.getClass().getName()); for (int i = 0; i < tabs; i++) { out.print("\t"); } out.println("Start: " + view.getStartOffset() + "; end: " + view.getEndOffset()); // Display child views, if any. int childViews = view.getViewCount(); for (int i = 0; i < childViews; i++) { View childView = view.getView(i); displayView(childView, tabs + 1, out); } }
From source file:com.sonarsource.lits.Dump.java
private static void endComponent(PrintStream out) { out.print("],\n"); }
From source file:org.apache.accumulo.server.util.DumpZookeeper.java
private static void write(PrintStream out, int indent, String fmt, Object... args) { for (int i = 0; i < indent; i++) out.print(" "); out.println(String.format(fmt, args)); }
From source file:Main.java
/** * @param xmlReader/* ww w .ja v a 2s. c o m*/ */ public static void printLiterally(final PrintStream os, final XMLStreamReader xmlReader) { final int start = xmlReader.getTextStart(); final int length = xmlReader.getTextLength(); os.print(new String(xmlReader.getTextCharacters(), start, length)); }
From source file:edu.cmu.cs.lti.ark.fn.utils.LemmatizeStuff.java
private static void run() throws FileNotFoundException { Scanner sc = new Scanner(new FileInputStream(infilename)); PrintStream ps = new PrintStream(new FileOutputStream(outfilename)); while (sc.hasNextLine()) { String line = sc.nextLine(); ps.print(line + "\t"); String[] toks = line.trim().split("\\s"); int sentLen = Integer.parseInt(toks[0]); for (int i = 0; i < sentLen; i++) { String lemma = lemmatizer.getLemma(toks[i + 1].toLowerCase(), toks[i + 1 + sentLen]); ps.print(lemma + "\t"); }/* w ww .j a va2 s. c o m*/ ps.println(); } sc.close(); closeQuietly(ps); }
From source file:MainClass.java
public static void print(Node node, OutputStream os) { PrintStream ps = new PrintStream(os); switch (node.getNodeType()) { case Node.ELEMENT_NODE: ps.print("<" + node.getNodeName()); NamedNodeMap map = node.getAttributes(); for (int i = 0; i < map.getLength(); i++) { ps.print(" " + map.item(i).getNodeName() + "=\"" + map.item(i).getNodeValue() + "\""); }// ww w. java2s . c om ps.println(">"); return; case Node.ATTRIBUTE_NODE: ps.println(node.getNodeName() + "=\"" + node.getNodeValue() + "\""); return; case Node.TEXT_NODE: ps.println(node.getNodeValue()); return; case Node.CDATA_SECTION_NODE: ps.println(node.getNodeValue()); return; case Node.PROCESSING_INSTRUCTION_NODE: ps.println(node.getNodeValue()); return; case Node.DOCUMENT_NODE: case Node.DOCUMENT_FRAGMENT_NODE: ps.println(node.getNodeName() + "=" + node.getNodeValue()); return; } }
From source file:Main.java
/** * Used for debuging/*from w w w .ja v a2 s. c om*/ * * @param parent * Element * @param out * PrintStream * @param deep * boolean * @param prefix * String */ public static void printChildElements(Element parent, PrintStream out, boolean deep, String prefix) { out.print(prefix + "<" + parent.getNodeName()); NamedNodeMap attrs = parent.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 = getElementTextValueDeprecated(parent); String data = parent.getNodeValue(); if (data != null && data.trim().length() > 0) { out.println(prefix + "\t" + data); } data = getElementCDataValue(parent); if (data != null && data.trim().length() > 0) { out.println(prefix + "\t<![CDATA[" + data + "]]>"); } NodeList nodes = parent.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { if (deep) { printChildElements((Element) node, out, deep, prefix + "\t"); } else { out.println(prefix + node.getNodeName()); } } } out.println(prefix + "</" + parent.getNodeName() + ">"); }
From source file:com.sonarsource.lits.Dump.java
private static void startComponent(PrintStream out, String componentKey) { out.print("'" + componentKey + "':[\n"); }
From source file:com.sonarsource.lits.Dump.java
private static void endRule(PrintStream out) { endComponent(out);// ww w. j av a 2 s . co m out.print("}\n"); Closeables.closeQuietly(out); }