Class Command


  • public class Command
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Command.CommandTimeout  
    • Constructor Summary

      Constructors 
      Constructor Description
      Command()
      Empty command constructor
    • Constructor Detail

      • Command

        public Command()
        Empty command constructor
    • Method Detail

      • execute

        public void execute()
                     throws Command.CommandTimeout,
                            java.io.IOException,
                            java.lang.InterruptedException
        Throws:
        Command.CommandTimeout - CommandTimeout
        java.io.IOException - IOException
        java.lang.InterruptedException - InterruptedException
      • getCommand

        public java.lang.String[] getCommand()
        Returns:
        string[]
      • setCommand

        public void setCommand​(java.lang.String command)
        Parameters:
        command - single command
      • setCommand

        public void setCommand​(java.lang.String[] commandArray)
        Parameters:
        commandArray - string[]
      • getEnvp

        public java.lang.String[] getEnvp()
        Returns:
        envp
      • setEnvp

        public void setEnvp​(java.lang.String[] envp)
        Parameters:
        envp - String[]
      • getDir

        public java.io.File getDir()
        Returns:
        dir
      • setDir

        public void setDir​(java.io.File dir)
        Parameters:
        dir - File
      • getTimeout

        public long getTimeout()
        Returns:
        timeout
      • setTimeout

        public void setTimeout​(long timeout)
        Parameters:
        timeout - long
      • getExitCode

        public int getExitCode()
        Returns:
        exitCode
      • setStdin

        public void setStdin​(java.io.InputStream stdin)
        Parameters:
        stdin - InputStream
      • getStdout

        public byte[] getStdout()
        Returns:
        stdout byte[]
      • getStderr

        public byte[] getStderr()
        Returns:
        stderr byte[]
      • splitCommand

        protected static java.lang.String[] splitCommand​(java.lang.String command)
        Split a command string into a command array. This version uses a StringTokenizer to split arguments. Quoted arguments are supported (single or double), with quotes removed before passing to runtime. Double quoting arguments will preserve quotes when passing to runtime.
        Parameters:
        command - command to run.
        Returns:
        Array of arguments suitable for passing to Runtime.exec(String[]).