List of usage examples for java.io PrintStream print
public void print(Object obj)
From source file:com.aptana.core.epl.downloader.RepositoryStatusHelper.java
private static void deeplyPrint(IStatus status, PrintStream strm, boolean stackTrace, int level) { appendLevelString(strm, level);/*from w ww . j av a 2 s . c o m*/ String msg = status.getMessage(); strm.println(msg); Throwable cause = status.getException(); if (cause != null) { strm.print("Caused by: "); //$NON-NLS-1$ if (stackTrace || !(msg.equals(cause.getMessage()) || msg.equals(cause.toString()))) deeplyPrint(cause, strm, stackTrace, level); } if (status.isMultiStatus()) { IStatus[] children = status.getChildren(); for (int i = 0; i < children.length; i++) deeplyPrint(children[i], strm, stackTrace, level + 1); } }
From source file:net.imagini.cassandra.DumpSSTables.SSTableExport.java
private static void writeMeta(PrintStream out, AbstractColumnContainer columnContainer) { out.print(getMeta(columnContainer)); }
From source file:de.uni.bremen.monty.moco.Main.java
private static void writeAssembly(String outputFileName, String inputFileName, String llvmCode) throws IOException { PrintStream assemblyStream = null; if (outputFileName != null) { assemblyStream = new PrintStream(outputFileName); } else if (inputFileName != null) { assemblyStream = new PrintStream(FilenameUtils.removeExtension(inputFileName) + ".ll"); } else {//from w w w .j a va 2 s .c om assemblyStream = new PrintStream("output.ll"); } assemblyStream.print(llvmCode); assemblyStream.close(); }
From source file:ch.epfl.leb.sass.commandline.CommandLineInterface.java
/** * Reads the welcome_text file and prints it to a PrintStream. * @param out stream to print to/* w w w. j a va 2 s . c om*/ */ public static void printWelcomeText(PrintStream out) { try { InputStream inputStream = urlToWelcomeText; ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) != -1) { result.write(buffer, 0, length); } String message = result.toString("UTF-8"); out.print(message + "\n"); } catch (IOException ex) { Logger.getLogger(CommandLineInterface.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:edu.utah.further.core.api.xml.XmlUtil.java
/** * @param xmlReader/*w w w. j a v a2 s .c o m*/ */ public static void printEndElement(final PrintStream os, final XMLStreamReader xmlReader) { os.print("</"); printName(os, xmlReader); os.print(">"); }
From source file:Transform.java
public static void multiplePages() throws Exception { InputStream isXML = Transform.class.getResourceAsStream(file("manual.xml")); InputStream isXSL = Transform.class.getResourceAsStream("html-pages.xsl"); StreamSource xsl = new StreamSource(isXSL); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(xsl); Match manual = $(isXML);// ww w.j av a 2 s . c o m replaceVariables(manual); List<String> ids = manual.find("section").ids(); HashSet<String> uniqueIds = new HashSet<String>(ids); if (ids.size() != uniqueIds.size()) { for (String id : uniqueIds) { ids.remove(id); } throw new Exception("Duplicate section ids found! " + ids); } int blanks = 0, completed = 0; for (Match section : manual.find("section").each()) { Match sections = section.add(section.parents("section")).reverse(); String path = path(StringUtils.join(sections.ids(), "/")); String relativePath = relative(path); String root = root(); File dir = new File(path); dir.mkdirs(); PrintStream stream = System.out; boolean blank = StringUtils.isBlank(section.find("content").text()); if (blank) { blanks++; stream = System.err; } else { completed++; } stream.print("["); stream.print(blank ? " " : "x"); stream.println("] Transforming section " + path); File file = new File(dir, "index.php"); file.delete(); FileOutputStream out = new FileOutputStream(file); Source source = new DOMSource(manual.document()); Result target = new StreamResult(out); transformer.setParameter("sectionID", section.id()); transformer.setParameter("relativePath", relativePath); transformer.setParameter("root", root); transformer.transform(source, target); out.close(); } System.out.println(" Completed sections : " + completed + " / " + (blanks + completed) + " (" + (100 * completed / (blanks + completed)) + "%)"); }
From source file:edu.umn.cs.sthadoop.hdfs.KNNJoin.java
static <S extends Shape> void write(Text text, Path outputPath) throws IOException { if (outputPath != null) { PrintStream ps = new PrintStream(new FileOutputStream(outputPath.toString(), true)); ps.print(text); ps.println();/* w ww .j a va2s . c o m*/ ps.close(); } }
From source file:com.yahoo.ycsb.bulk.hbase.BulkDataGeneratorJob.java
public static void printKeyValues(Configuration conf, String[] keys, PrintStream out) { for (String k : keys) { out.print(k); out.print('='); out.println(conf.get(k));//from w w w.ja v a 2 s. c o m } out.println(); }
From source file:org.apache.cassandra.tools.SSTableExport.java
/** * Serialize columns using given column iterator * @param columns column iterator/*from www. j av a2 s. c o m*/ * @param out output stream * @param comparator columns comparator * @param cfMetaData Column Family metadata (to get validator) * @return pair of (number of columns serialized, last column serialized) */ private static void serializeColumns(Iterator<IColumn> columns, PrintStream out, AbstractType comparator, CFMetaData cfMetaData) { while (columns.hasNext()) { IColumn column = columns.next(); serializeColumn(column, out, comparator, cfMetaData); if (columns.hasNext()) out.print(", "); } }
From source file:esiptestbed.mudrod.ontology.process.LocalOntology.java
protected static void renderAnonymous(PrintStream out, Resource anon, String name) { String anonID = (String) mAnonIDs.get(anon.getId()); if (anonID == null) { anonID = "a-" + mAnonCount++; mAnonIDs.put(anon.getId(), anonID); }/*from w w w . j av a 2s .c o m*/ out.print("Anonymous "); out.print(name); out.print(" with ID "); out.print(anonID); }