Package io.pravega.common.lang
Class ProcessStarter
- java.lang.Object
-
- io.pravega.common.lang.ProcessStarter
-
@NotThreadSafe public class ProcessStarter extends java.lang.ObjectHelps start a Class out of Process.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessStarterargs(java.lang.Object... args)Starts the Process using the given command-line arguments.ProcessStarterenv(java.lang.String name, java.lang.Object value)Includes the given Environment Variable as part of the start.static ProcessStarterforClass(java.lang.Class<?> target)Creates a new instance of the ProcessStarter class.java.lang.Processstart()Executes the Class using the accumulated options.ProcessStarterstdErr(java.lang.ProcessBuilder.Redirect redirect)Redirects the Standard Err of the Process to the given Redirect.ProcessStarterstdIn(java.lang.ProcessBuilder.Redirect redirect)Redirects the Standard In of the Process to the given Redirect.ProcessStarterstdOut(java.lang.ProcessBuilder.Redirect redirect)Redirects the Standard Out of the Process to the given Redirect.ProcessStartersysProp(java.lang.String name, java.lang.Object value)Includes the given System Property as part of the start.
-
-
-
Method Detail
-
forClass
public static ProcessStarter forClass(java.lang.Class<?> target)
Creates a new instance of the ProcessStarter class.- Parameters:
target- The Class to start. This class must have a static main() method defined in it.- Returns:
- new ProcessStarter instance
-
sysProp
public ProcessStarter sysProp(java.lang.String name, java.lang.Object value)
Includes the given System Property as part of the start.- Parameters:
name- The System Property Name.value- The System Property Value. This will have toString() invoked on it.- Returns:
- This object instance.
-
env
public ProcessStarter env(java.lang.String name, java.lang.Object value)
Includes the given Environment Variable as part of the start.- Parameters:
name- The Environment Variable Name.value- The Environment Variable Value. This will have toString() invoked on it.- Returns:
- This object instance.
-
stdOut
public ProcessStarter stdOut(java.lang.ProcessBuilder.Redirect redirect)
Redirects the Standard Out of the Process to the given Redirect.- Parameters:
redirect- The ProcessBuilder.Redirect to use.- Returns:
- This object instance.
-
stdErr
public ProcessStarter stdErr(java.lang.ProcessBuilder.Redirect redirect)
Redirects the Standard Err of the Process to the given Redirect.- Parameters:
redirect- The ProcessBuilder.Redirect to use.- Returns:
- This object instance.
-
stdIn
public ProcessStarter stdIn(java.lang.ProcessBuilder.Redirect redirect)
Redirects the Standard In of the Process to the given Redirect.- Parameters:
redirect- The ProcessBuilder.Redirect to use.- Returns:
- This object instance.
-
args
public ProcessStarter args(java.lang.Object... args)
Starts the Process using the given command-line arguments.- Parameters:
args- The arguments to use.- Returns:
- This object instance.
-
start
public java.lang.Process start() throws java.io.IOExceptionExecutes the Class using the accumulated options.- Returns:
- The Process reference.
- Throws:
java.io.IOException- If an error occurred.
-
-