List of usage examples for java.io PrintStream println
public void println(Object x)
From source file:Main.java
public static void copyFile(File from, File toFile, PrintStream reportStream) { if (reportStream != null) { reportStream.println("Coping file " + from.getAbsolutePath() + " to " + toFile.getAbsolutePath()); }//w ww . j a v a2 s . co m if (!from.exists()) { throw new IllegalArgumentException("File " + from.getPath() + " does not exist."); } if (from.isDirectory()) { throw new IllegalArgumentException(from.getPath() + " is a directory. Should be a file."); } try { final InputStream in = new FileInputStream(from); if (!toFile.getParentFile().exists()) { toFile.getParentFile().mkdirs(); } if (!toFile.exists()) { toFile.createNewFile(); } final OutputStream out = new FileOutputStream(toFile); final byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); } catch (final IOException e) { throw new RuntimeException( "IO exception occured while copying file " + from.getPath() + " to " + toFile.getPath(), e); } }
From source file:com.aliyun.openservices.odps.console.resource.ListResourcesCommand.java
public static void printUsage(PrintStream out) { out.println("Usage: ls|list resources [-p <projectname>] [-l]"); }
From source file:com.aliyun.openservices.odps.console.resource.CreateResourceCommand.java
public static void printUsage(PrintStream stream) { stream.println("Usage: create resource <type> <refname> [[<(spec)>)] <alias>] "); stream.println(" [-p,-project <projectname>] [-c,-comment <comment>] [-f,-force]"); }
From source file:TestDumpRecord.java
private static void dumpRecord(Record record, Reader reader, PrintStream out) throws NITFException { out.println("----- Header -----"); record.getHeader().print(out);//from w w w .j a v a2 s . c om final ImageSegment[] images = record.getImages(); for (int i = 0; i < images.length; i++) { out.println("----- Image[" + i + "] -----"); ImageSegment image = images[i]; image.getSubheader().print(out); } final GraphicSegment[] graphics = record.getGraphics(); for (int i = 0; i < graphics.length; i++) { out.println("----- Graphic[" + i + "] -----"); GraphicSegment graphic = graphics[i]; graphic.getSubheader().print(out); } final LabelSegment[] labels = record.getLabels(); for (int i = 0; i < labels.length; i++) { out.println("----- Label[" + i + "] -----"); LabelSegment label = labels[i]; label.getSubheader().print(out); } final TextSegment[] texts = record.getTexts(); for (int i = 0; i < texts.length; i++) { out.println("----- Text[" + i + "] -----"); TextSegment text = texts[i]; text.getSubheader().print(out); SegmentReader textReader = reader.getNewTextReader(i); byte[] data = new byte[(int) textReader.getSize()]; textReader.read(data); out.println("TEXT[" + i + "] = '" + new String(data) + "'"); } final DESegment[] dataExtensions = record.getDataExtensions(); for (int i = 0; i < dataExtensions.length; i++) { out.println("----- DES[" + i + "] -----"); DESegment dataExtension = dataExtensions[i]; dataExtension.getSubheader().print(out); SegmentReader segReader = reader.getNewDEReader(i); byte[] data = new byte[(int) segReader.getSize()]; segReader.read(data); out.println("DES[" + i + "] = '" + new String(data) + "'"); } final RESegment[] reservedExtensions = record.getReservedExtensions(); for (int i = 0; i < reservedExtensions.length; i++) { out.println("----- RES[" + i + "] -----"); RESegment reservedExtension = reservedExtensions[i]; reservedExtension.getSubheader().print(out); } }
From source file:com.aliyun.openservices.odps.console.SelectCommand.java
public static void printUsage(PrintStream out) { out.println("Usage: select <selectstatement>"); }
From source file:co.cask.tigon.StandaloneMain.java
private static void usage(boolean error) { PrintStream out = (error ? System.err : System.out); out.println("java -cp .:lib/* co.cask.tigon.StandaloneMain <path-to-JAR> <FlowClassName> [arguments]"); out.println("Example: java -cp .:lib/* co.cask.tigon.StandaloneMain /home/user/tweetFlow-1.0.jar " + "com.cname.main.TweetFlow --runtimeKey=value"); out.println(""); if (error) {//from ww w .ja v a 2 s. co m throw new IllegalArgumentException(); } }
From source file:Main.java
public static String getSystemOutput(String paramString) { String str1 = ""; try {//from w w w .j av a 2 s .c o m Process localProcess = Runtime.getRuntime().exec(paramString); InputStream localInputStream = localProcess.getInputStream(); InputStreamReader localInputStreamReader = new InputStreamReader(localInputStream); BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader); for (;;) { String str2 = localBufferedReader.readLine(); if (str2 == null) { break; } StringBuilder localStringBuilder1 = new StringBuilder(); str1 = str1 + str2; StringBuilder localStringBuilder2 = new StringBuilder(); str1 = str1 + "\n"; } int i = localProcess.waitFor(); PrintStream localPrintStream = System.out; StringBuilder localStringBuilder3 = new StringBuilder(); localPrintStream.println("Process exitValue: " + i); return str1; } catch (Throwable localThrowable) { for (;;) { localThrowable.printStackTrace(); } } }
From source file:Main.java
private static void dumpHeaders(HttpURLConnection conn, PrintStream out) { for (Map.Entry<String, List<String>> e : conn.getHeaderFields().entrySet()) for (String v : e.getValue()) out.println("received header " + e.getKey() + ": " + v); }
From source file:com.aliyun.openservices.odps.console.resource.ListFunctionsCommand.java
public static void printUsage(PrintStream out) { out.println("Usage: list functions"); out.println(" ls functions [-p <projectname>]"); }
From source file:com.aliyun.openservices.odps.console.commands.logview.HelpAction.java
public static void printHelpInfo(PrintStream stream) { // Overall help message stream.println("Usage: log <subcommand> [options] [args]"); StringBuilder sb = new StringBuilder(); boolean first = true; for (String key : ActionRegistry.getActionNames()) { // Hide status action temporarily if (key.equalsIgnoreCase(GetStatusAction.ACTION_NAME)) { continue; }//from w w w. j av a 2 s .c om if (first) { first = false; } else { sb.append(", "); } sb.append(key); } stream.println("Available subcommands are: " + sb.toString()); stream.println("Use 'log help <subcommand>' to get more info"); }