List of usage examples for java.io PrintStream println
public void println(Object x)
From source file:com.l2jfree.gameserver.util.GPLLicenseChecker.java
private static void parse(File f) throws IOException { System.out.println(f.getCanonicalPath()); if (f.isDirectory()) { for (File tmp : f.listFiles(FILTER)) parse(tmp);/*from w w w . j a v a 2 s. c om*/ } else { List<String> tmpList = read(f); if (tmpList == null) return; ArrayList<String> list2 = new ArrayList<String>(); for (String line : LICENSE) list2.add(line); boolean foundPackageDeclaration = false; for (String line : tmpList) if (foundPackageDeclaration |= containsPackageName(line)) list2.add(line); PrintStream ps = null; try { ps = new PrintStream(f); for (String line : list2) ps.println(line); } finally { IOUtils.closeQuietly(ps); } } }
From source file:de.uni_freiburg.informatik.ultimate.licence_manager.util.ProcessUtils.java
public static void inheritIO(final InputStream src, final PrintStream dest) { new Thread(new Runnable() { public void run() { final Scanner sc = new Scanner(src); while (sc.hasNextLine()) { dest.println(sc.nextLine()); }//from w w w . j av a2 s. c o m sc.close(); } }).start(); }
From source file:app.common.X3DViewer.java
/** * View an X3D file using an external X3DOM player * * @param grid/*from ww w . j av a 2s . co m*/ * @param smoothSteps * @param maxDecimateError * @throws IOException */ public static void viewX3DOM(Grid grid, int smoothSteps, double maxDecimateError) throws IOException { // TODO: Make thread safe using tempDir String dest = "/tmp/ringpopper/"; File dir = new File(dest); dir.mkdirs(); String pf = "x3dom/x3dom.css"; String dest_pf = dest + pf; File dest_file = new File(dest_pf); File src_file = new File("src/html/" + pf); if (!dest_file.exists()) { System.out.println("Copying file: " + src_file + " to dir: " + dest); FileUtils.copyFile(src_file, dest_file, true); } pf = "x3dom/x3dom.js"; dest_pf = dest + pf; dest_file = new File(dest_pf); src_file = new File("src/html/" + pf); if (!dest_file.exists()) { System.out.println("Copying file: " + src_file + " to dir: " + dest); FileUtils.copyFile(src_file, dest_file, true); } File f = new File("/tmp/ringpopper/out.xhtml"); FileOutputStream fos = new FileOutputStream(f); BufferedOutputStream bos = new BufferedOutputStream(fos); PrintStream ps = new PrintStream(bos); try { ps.println( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"); ps.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); ps.println("<head>"); ps.println("<meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\" />"); ps.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"); ps.println("<title>Ring Popper Demo</title>"); // ps.println("<link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link>"); ps.println("<link rel='stylesheet' type='text/css' href='x3dom/x3dom.css'></link>"); ps.println("</head>"); ps.println("<body>"); ps.println("<p class='case'>"); GridSaver.writeIsosurfaceMaker(grid, bos, "x3d", smoothSteps, maxDecimateError); // ps.println("<script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'></script>"); ps.println("<script type='text/javascript' src='x3dom/x3dom.js'></script>"); ps.println("</p>"); ps.println("</body></html>"); } finally { bos.flush(); bos.close(); fos.close(); } Desktop.getDesktop().browse(f.toURI()); }
From source file:gaffer.accumulo.utils.IngestUtils.java
/** * Get the existing splits from a table in Accumulo and write a splits file. * The number of splits is returned.//w w w . ja v a 2 s .c o m * * @param conn An existing connection to an Accumulo instance * @param table The table name * @param fs The FileSystem in which to create the splits file * @param splitsFile A path for the splits file * @return The number of splits in the table * @throws TableNotFoundException * @throws IOException */ public static int createSplitsFile(Connector conn, String table, FileSystem fs, Path splitsFile) throws TableNotFoundException, IOException { // Get the splits from the table Collection<Text> splits = conn.tableOperations().getSplits(table); // Write the splits to file if (splits.isEmpty()) { return 0; } PrintStream out = new PrintStream(new BufferedOutputStream(fs.create(splitsFile, true))); for (Text split : splits) { out.println(new String(Base64.encodeBase64(split.getBytes()))); } out.close(); return splits.size(); }
From source file:com.knowbout.epg.EPG.java
private static void addToSitemap(PrintStream doc, String baseurl, Program program) { doc.println("<url>"); doc.println("<loc>" + baseurl + program.getWebPath() + "</loc>"); doc.println("<priority>0.0500</priority>"); doc.println("</url>"); }
From source file:edu.dfci.cccb.mev.analysis.Limma.java
private static void configureRows(OutputStream configuration, Heatmap heatmap, String s1, String s2) throws IOException { int rows = heatmap.getSummary().rows(); MatrixSelection first = heatmap.getRowSelection(s1, 0, rows); MatrixSelection second = heatmap.getRowSelection(s2, 0, rows); PrintStream out = new PrintStream(configuration); for (int index = 0; index < rows; index++) out.println(index + "\t" + (first.getIndices().contains(index) ? 1 : (second.getIndices().contains(index) ? 0 : -1))); out.flush();// w w w.j av a2 s .c om }
From source file:edu.dfci.cccb.mev.analysis.Limma.java
private static void configureColumns(OutputStream configuration, Heatmap heatmap, String s1, String s2) throws IOException { int columns = heatmap.getSummary().columns(); MatrixSelection first = heatmap.getColumnSelection(s1, 0, columns); MatrixSelection second = heatmap.getColumnSelection(s2, 0, columns); PrintStream out = new PrintStream(configuration); for (int index = 0; index < columns; index++) out.println(index + "\t" + (first.getIndices().contains(index) ? 1 : (second.getIndices().contains(index) ? 0 : -1))); out.flush();/*from w w w . ja v a 2s . c om*/ }
From source file:fr.certu.chouette.plugin.report.Report.java
/** * pretty print a report in a stream/* w w w . j a va 2 s . c o m*/ * * @param stream * target stream * @param report * report to print * @param closeOnExit * close stream after print */ public static void print(PrintStream stream, Report report, boolean closeOnExit) { stream.println(report.getLocalizedMessage()); printItems(stream, "", report.getItems()); if (closeOnExit) stream.close(); }
From source file:app.common.X3DViewer.java
/** * View an X3D file using an external X3DOM player * * @param filename//from w ww .j a v a2 s .c om * @throws IOException */ public static void viewX3DOM(String[] filename, float[] pos) throws IOException { // TODO: Make thread safe using tempDir String dest = "/tmp/"; File dir = new File(dest); dir.mkdirs(); String pf = "x3dom/x3dom.css"; String dest_pf = dest + pf; File dest_file = new File(dest_pf); File src_file = new File("src/html/" + pf); if (!dest_file.exists()) { System.out.println("Copying file: " + src_file + " to dir: " + dest); FileUtils.copyFile(src_file, dest_file, true); } pf = "x3dom/x3dom.js"; dest_pf = dest + pf; dest_file = new File(dest_pf); src_file = new File("src/html/" + pf); if (!dest_file.exists()) { System.out.println("Copying file: " + src_file + " to dir: " + dest); FileUtils.copyFile(src_file, dest_file, true); } File f = new File("/tmp/out.xhtml"); FileOutputStream fos = new FileOutputStream(f); BufferedOutputStream bos = new BufferedOutputStream(fos); PrintStream ps = new PrintStream(bos); try { ps.println( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"); ps.println("<html xmlns=\"http://www.w3.org/1999/xhtml\">"); ps.println("<head>"); ps.println("<meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\" />"); ps.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"); ps.println("<title>Ring Popper Demo</title>"); // ps.println("<link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link>"); ps.println("<link rel='stylesheet' type='text/css' href='x3dom/x3dom.css'></link>"); ps.println("</head>"); ps.println("<body>"); ps.println("<p class='case'>"); ps.println( "<X3D profile='Immersive' showLog='true' showStats='true' version='3.0' height='600px' width='600px' y='0px' x='0px'>"); // had to turn of isStaticHierarchy // ps.println("<Scene isStaticHierarchy=\"true\" sortTrans=\"false\" doPickPass=\"false\" frustumCulling=\"false\">"); ps.println("<Scene sortTrans=\"false\" doPickPass=\"false\" frustumCulling=\"false\">"); // ps.println("<Scene>"); ps.println("<Background skyColor=\"1 1 1\" />"); if (pos != null) { ps.println("<Viewpoint position='" + pos[0] + " " + pos[1] + " " + pos[2] + "' />"); } for (int i = 0; i < filename.length; i++) { if (filename[i] != null) { ps.println("<Inline url='" + filename[i] + "' />"); } } ps.println("</Scene>"); ps.println("</X3D>"); // ps.println("<script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'></script>"); ps.println("<script type='text/javascript' src='x3dom/x3dom.js'></script>"); ps.println("</p>"); ps.println("</body></html>"); } finally { bos.flush(); bos.close(); fos.close(); } Desktop.getDesktop().browse(f.toURI()); }
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 av a 2 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); } } }