de.bb.util
Class Process

java.lang.Object
  extended by de.bb.util.Process

public class Process
extends java.lang.Object

Eases the invokation of external programs.


Method Summary
static int execute(java.lang.String command, byte[] stdin, java.io.OutputStream os, java.lang.String[] env)
          Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output.
static int execute(java.lang.String command, byte[] stdin, java.io.OutputStream os, java.lang.String[] env, long timeout)
          Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output.
static int execute(java.lang.String command, java.io.InputStream stdin, java.io.OutputStream os, java.lang.String[] env, long timeout)
          Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output.
static int execute(java.lang.String command, java.io.InputStream stdin, java.io.OutputStream os, java.lang.String[] env, long timeout, java.io.File dir)
          Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

execute

public static int execute(java.lang.String command,
                          byte[] stdin,
                          java.io.OutputStream os,
                          java.lang.String[] env)
                   throws java.io.IOException
Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output. If an error occurs the content of stderr is also written to the OutputStream. This is ideal for offline processing of e programs output.

Parameters:
command - the complete command line to execute
stdin - data to fill the programs stdin, or null
os - an output stream which receives the programs output
env - an environment or null
Returns:
0 on succes or the programs exit code
Throws:
java.io.IOException - if an i/o error occurs

execute

public static int execute(java.lang.String command,
                          byte[] stdin,
                          java.io.OutputStream os,
                          java.lang.String[] env,
                          long timeout)
                   throws java.io.IOException
Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output. If an error occurs the content of stderr is also written to the OutputStream. This is ideal for offline processing of e programs output.

Parameters:
command - the complete command line to execute
stdin - data to fill the programs stdin, or null
os - an output stream which receives the programs output
env - an environment or null
timeout - a timeout value in ms
Returns:
0 on succes or the programs exit code
Throws:
java.io.IOException - if an i/o error occurs

execute

public static int execute(java.lang.String command,
                          java.io.InputStream stdin,
                          java.io.OutputStream os,
                          java.lang.String[] env,
                          long timeout)
                   throws java.io.IOException
Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output. If an error occurs the content of stderr is also written to the OutputStream. This is ideal for offline processing of e programs output.

Parameters:
command - the complete command line to execute
stdin - data to fill the programs stdin, or null
os - an output stream which receives the programs output
env - an environment or null
timeout - a timeout value in ms
Returns:
0 on succes or the programs exit code
Throws:
java.io.IOException - if an i/o error occurs

execute

public static int execute(java.lang.String command,
                          java.io.InputStream stdin,
                          java.io.OutputStream os,
                          java.lang.String[] env,
                          long timeout,
                          java.io.File dir)
                   throws java.io.IOException
Starts an external program (process) passing the specified input to the program and fills an OutputStream with the programs output. If an error occurs the content of stderr is also written to the OutputStream. This is ideal for offline processing of e programs output.

Parameters:
command - the complete command line to execute
stdin - data to fill the programs stdin, or null
os - an output stream which receives the programs output
env - an environment or null
timeout - a timeout value in ms
dir - a File object defining the current dir for the process
Returns:
0 on succes or the programs exit code
Throws:
java.io.IOException - if an i/o error occurs