Class Command

java.lang.Object
gov.usgs.earthquake.distribution.Command

public class Command extends Object
Class encapsulates commands including command line arguments
  • Constructor Details

    • Command

      public Command()
      Empty command constructor
  • Method Details

    • execute

      Throws:
      Command.CommandTimeout - CommandTimeout
      IOException - IOException
      InterruptedException - InterruptedException
    • getCommand

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

      public void setCommand(String command)
      Parameters:
      command - single command
    • setCommand

      public void setCommand(String[] commandArray)
      Parameters:
      commandArray - string[]
    • getEnvp

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

      public void setEnvp(String[] envp)
      Parameters:
      envp - String[]
    • getDir

      public File getDir()
      Returns:
      dir
    • setDir

      public void setDir(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(InputStream stdin)
      Parameters:
      stdin - InputStream
    • getStdout

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

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

      protected static String[] splitCommand(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[]).