Package oms3.util

Class Processes


  • public class Processes
    extends Object
    ProcessExcecution. Helper class to execute external programs.
    Author:
    od
    • Constructor Detail

      • Processes

        public Processes​(File executable)
        Create a new ProcessExecution.
        Parameters:
        executable - the executable file.
    • Method Detail

      • setLog

        public void setLog​(Logger log)
      • setArguments

        public void setArguments​(Object... args)
        Set the execution arguments.
        Parameters:
        args - the command line arguments
      • setWorkingDirectory

        public void setWorkingDirectory​(File dir)
        Set the working directory where the process get executed.
        Parameters:
        dir - the directory in which the executable will be started
      • environment

        public Map<String,​String> environment()
        get the execution environment. Use the returned map to customize the environment variables.
        Returns:
        the process environment.
      • exec

        public int exec()
                 throws IOException
        Process execution. This call blocks until the process is done.
        Returns:
        the exit status of the process.
        Throws:
        Exception
        IOException
      • redirectOutput

        public void redirectOutput​(Writer w)
        Redirect the output stream
        Parameters:
        w - the stream handler
      • redirectError

        public void redirectError​(Writer w)
        Redirect the error stream
        Parameters:
        w - the new handler.