php.java.bridge
Class Util.Process

java.lang.Object
  extended by java.lang.Process
      extended by php.java.bridge.Util.Process
Direct Known Subclasses:
FCGIProcess, Util.ProcessWithErrorHandler
Enclosing class:
Util

public static class Util.Process
extends java.lang.Process

Starts a CGI process and returns the process handle.


Nested Class Summary
static class Util.Process.PhpException
          A generic PHP exception
 
Method Summary
 void checkError()
          Check for a PHP fatal error and throw a PHP exception if necessary.
 void destroy()
          
 int exitValue()
          
 java.io.InputStream getErrorStream()
          
 java.io.InputStream getInputStream()
          
 java.io.OutputStream getOutputStream()
          
static Util.Process start(java.lang.String[] args, boolean includeJava, java.lang.String cgiDir, java.lang.String pearDir, java.lang.String webInfDir, java.io.File homeDir, java.util.Map env, boolean tryOtherLocations, boolean preferSystemPhp, java.io.OutputStream err)
          Starts a CGI process and returns the process handle.
 int waitFor()
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

start

public static Util.Process start(java.lang.String[] args,
                                 boolean includeJava,
                                 java.lang.String cgiDir,
                                 java.lang.String pearDir,
                                 java.lang.String webInfDir,
                                 java.io.File homeDir,
                                 java.util.Map env,
                                 boolean tryOtherLocations,
                                 boolean preferSystemPhp,
                                 java.io.OutputStream err)
                          throws java.io.IOException
Starts a CGI process and returns the process handle.

Parameters:
args - The args array, e.g.: new String[]{null, "-b", ...};. If args is null or if args[0] is null, the function looks for the system property "php.java.bridge.php_exec".
homeDir - The home directory. If null, the current working directory is used.
env - The CGI environment. If null, Util.DEFAULT_CGI_ENVIRONMENT is used.
tryOtherLocations - true if we should check the DEFAULT_CGI_LOCATIONS first
preferSystemPhp -
err -
Returns:
The process handle.
Throws:
java.io.IOException
java.lang.NullPointerException
java.io.IOException
See Also:
Util.checkCgiBinary(String)

checkError

public void checkError()
                throws Util.Process.PhpException
Check for a PHP fatal error and throw a PHP exception if necessary.

Throws:
Util.Process.PhpException

getOutputStream

public java.io.OutputStream getOutputStream()

Specified by:
getOutputStream in class java.lang.Process

getInputStream

public java.io.InputStream getInputStream()

Specified by:
getInputStream in class java.lang.Process

getErrorStream

public java.io.InputStream getErrorStream()

Specified by:
getErrorStream in class java.lang.Process

waitFor

public int waitFor()
            throws java.lang.InterruptedException

Specified by:
waitFor in class java.lang.Process
Throws:
java.lang.InterruptedException

exitValue

public int exitValue()

Specified by:
exitValue in class java.lang.Process

destroy

public void destroy()

Specified by:
destroy in class java.lang.Process