com.darwinsys.lang
Class ExecAndPrint

java.lang.Object
  extended by com.darwinsys.lang.ExecAndPrint

public class ExecAndPrint
extends java.lang.Object

ExecAndPrint runs a program using Runtime.exec(), read the program's output, and returns its exit status.


Field Summary
protected static java.lang.Runtime r
          Need a Runtime object for any of these methods
 
Constructor Summary
ExecAndPrint()
           
 
Method Summary
static int run(java.lang.String cmd)
          Run the command given as a String, printing its output to System.out
static int run(java.lang.String[] cmd)
          Run the command given as a String[], print its output to System.out
static int run(java.lang.String[] cmd, java.io.Writer out)
          Run the command given as a String[], print its output to "out"
static int run(java.lang.String cmd, java.io.Writer out)
          Run the command given as a String, print its output to "out"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

r

protected static final java.lang.Runtime r
Need a Runtime object for any of these methods

Constructor Detail

ExecAndPrint

public ExecAndPrint()
Method Detail

run

public static int run(java.lang.String cmd)
               throws java.io.IOException
Run the command given as a String, printing its output to System.out

Throws:
java.io.IOException

run

public static int run(java.lang.String cmd,
                      java.io.Writer out)
               throws java.io.IOException
Run the command given as a String, print its output to "out"

Throws:
java.io.IOException

run

public static int run(java.lang.String[] cmd)
               throws java.io.IOException
Run the command given as a String[], print its output to System.out

Throws:
java.io.IOException

run

public static int run(java.lang.String[] cmd,
                      java.io.Writer out)
               throws java.io.IOException
Run the command given as a String[], print its output to "out"

Throws:
java.io.IOException


Copyright © 1996-2004 Ian F. Darwin. See license.html for usage license.