List of usage examples for java.io PrintStream print
public void print(Object obj)
From source file:au.com.jwatmuff.eventmanager.export.CSVExporter.java
private static void outputRow(Object[] fields, PrintStream out) { boolean first = true; for (Object field : fields) { if (!first) out.print(","); if (field != null) { if (field instanceof Number) { out.print(field);/*from w w w .ja v a2s. c o m*/ } else { out.print("\"" + field + "\""); } } first = false; } out.println(); }
From source file:ShowHTMLViews.java
public static void displayView(View view, int indent, Document doc, PrintStream out) { String name = view.getClass().getName(); for (int i = 0; i < indent; i++) { out.print(" "); }/*from w w w. j a va 2 s .com*/ int start = view.getStartOffset(); int end = view.getEndOffset(); out.println(name + "; offsets [" + start + ", " + end + "]"); for (int i = 0; i < indent; i++) { out.print(" "); } HTMLDocDisplay.displayAttributes(view.getAttributes(), indent, out); int viewCount = view.getViewCount(); if (viewCount == 0) { int length = Math.min(32, end - start); try { String txt = doc.getText(start, length); for (int i = 0; i < indent + 1; i++) { out.print(" "); } out.println("[" + txt + "]"); } catch (BadLocationException e) { } } else { for (int i = 0; i < viewCount; i++) { displayView(view.getView(i), indent + 1, doc, out); } } out.println(""); }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.Timing.java
/** * Prints the collected timer data to the specified {@link PrintStream}. * //from ww w. j a va 2 s . c om * @param out the stream to which data is printed */ public static void printStatistics(PrintStream out) { for (Map.Entry<String, SummaryStatistics> entry : data.entrySet()) { out.print(entry.getKey()); out.print(": "); out.print(entry.getValue().getMin() / 1000000000.0); out.print(' '); out.print(entry.getValue().getMean() / 1000000000.0); out.print(' '); out.print(entry.getValue().getMax() / 1000000000.0); out.print(' '); out.print(entry.getValue().getN()); out.println(); } }
From source file:de.uni.bremen.monty.moco.Main.java
private static File buildExecutable(String outputFileName, String inputFileName, boolean compileOnly, String llvmCode) throws IOException, InterruptedException { File outputFile = null;//from www . ja v a2 s .c om if (outputFileName != null) { outputFile = new File(outputFileName); } else if (inputFileName != null) { outputFile = new File(FilenameUtils.removeExtension(inputFileName)); } else if (compileOnly) { outputFile = File.createTempFile("output", null, null); outputFile.deleteOnExit(); } else { outputFile = new File("output"); } ProcessBuilder llcProcessBuilder = new ProcessBuilder("llc", "-O=2"); Process llcProcess = llcProcessBuilder.start(); PrintStream llcInput = new PrintStream(llcProcess.getOutputStream()); llcInput.print(llvmCode); llcInput.close(); ProcessBuilder ccProcessBuilder = new ProcessBuilder("cc", "-x", "assembler", "-o", outputFile.getAbsolutePath(), "-"); Process ccProcess = ccProcessBuilder.start(); IOUtils.copy(llcProcess.getInputStream(), ccProcess.getOutputStream()); ccProcess.getOutputStream().close(); System.err.print(IOUtils.toString(llcProcess.getErrorStream())); System.err.print(IOUtils.toString(ccProcess.getErrorStream())); return outputFile; }
From source file:com.arcusys.liferay.vaadinplugin.util.WidgetsetUtil.java
/** * Creates a widgetset .gwt.xml file under a given directory. * * @param widgetset//from w ww . j a v a2 s.c o m * the name of Widgetset. For example: com.example.TestWidgetSet * @throws java.io.IOException */ public static void createWidgetset(File tmpDir, String widgetset, Set<String> includeWidgetsets) throws IOException { String dir = widgetset.substring(0, widgetset.lastIndexOf(".")).replace(".", ControlPanelPortletUtil.FileSeparator); String file = widgetset.substring(widgetset.lastIndexOf(".") + 1, widgetset.length()) + ".gwt.xml"; File widgetsetDir = new File(tmpDir, dir); if (!widgetsetDir.mkdirs()) { throw new IOException("Could not create dir: " + widgetsetDir.getAbsolutePath()); } File widgetsetFile = new File(widgetsetDir, file); if (!widgetsetFile.createNewFile()) { throw new IOException(""); } PrintStream printStream = new PrintStream(new FileOutputStream(widgetsetFile)); printStream.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD " + "Google Web Toolkit 1.7.0//EN\" \"http://google" + "-web-toolkit.googlecode.com/svn/tags/1.7.0/dis" + "tro-source/core/src/gwt-module.dtd\">\n"); printStream.print("<module>\n"); for (String ws : includeWidgetsets) { printStream.print("<inherits name=\"" + ws + "\" />\n"); } printStream.print("\n</module>\n"); printStream.close(); }
From source file:com.marketplace.Utils.java
/** * Converts a list of Android permissions to a corresponding int value in * database. If a new permission is found, then that permission gets added * to an external file 'permission' found in the directory config. * /*w ww. j a va 2s . c o m*/ * @param permissions * a list of permissions that needs to be converted. * * @return a list of corresponding int value. */ synchronized public static List<Integer> permissionToInt(List<String> permissions) { List<Integer> pListArr = new ArrayList<Integer>(permissions.size()); for (String permission : permissions) { if (pMap.containsKey(permission)) { pListArr.add(pMap.get(permission)); } else { try { log.info("New permission found. Adding to the database"); PrintStream printStream = new PrintStream(new FileOutputStream(Utils.fileName, true), true); printStream.print(permission + "\t" + (pMap.size() + 1) + "\n"); printStream.close(); pMap.put(permission, pMap.size() + 1); new Sender().doBasicHttpPost("{\"permission\":\"" + permission + "\"}", Constants.newPermissionUrlJson); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ConnectivityException e) { log.info("There was a problem connecting to the database"); } } } return pListArr; }
From source file:org.apache.bookkeeper.tools.framework.CommandUtils.java
private static void printIndent(PrintStream printer, int indent) { IntStream.range(0, indent).forEach(ignored -> printer.print(" ")); }
From source file:ShowHTMLViews.java
public static void displayAttributes(AttributeSet a, int indent, PrintStream out) { if (a == null) return;/*w ww. jav a 2 s . c o m*/ a = a.copyAttributes(); Enumeration x = a.getAttributeNames(); for (int i = 0; i < indent; i++) { out.print(" "); } if (x != null) { 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()) + "] "); } } else { out.println("No attributes"); } if (a.getResolveParent() != null) { displayAttributes(a.getResolveParent().copyAttributes(), indent + 1, out); } }
From source file:org.apache.openejb.assembler.classic.cmd.Info2Properties.java
private static void print(final PrintStream out, final String text) { out.print(text); }
From source file:dk.hippogrif.prettyxml.app.Main.java
private static void optionUsage(PrintStream ps) { for (Iterator iter = optionList.iterator(); iter.hasNext();) { Option option = (Option) iter.next(); ps.print(" -" + option.getOpt()); String spaces = " "; int i = 0; if (option.hasArg()) { ps.print(" " + option.getArgName()); i = option.getArgName().length() + 1; }/*from ww w. j a v a 2 s . c o m*/ ps.print(spaces.substring(i)); ps.println(option.getDescription()); } }