Class ToolRunner

java.lang.Object
org.tentackle.common.ToolRunner

public class ToolRunner extends Object
Runner for external tools.
  • Constructor Details

    • ToolRunner

      public ToolRunner(File tool)
      Creates a runner for a tool.

      Throws TentackleRuntimeException if tool not found or not executable.

      Parameters:
      tool - the tool
  • Method Details

    • arg

      public ToolRunner arg(Object... args)
      Adds arguments.
      Parameters:
      args - the arguments
      Returns:
      this runner
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • run

      public ToolRunner run()
      Runs the tool.

      Throws TentackleRuntimeException if running the tool failed.

      Returns:
      this runner
    • getOutput

      public List<String> getOutput()
      Gets the standard output.
      Returns:
      the output lines, never null
    • getOutputAsString

      public String getOutputAsString()
      Gets the standard output.
      Returns:
      the output, never null
    • getErrors

      public List<String> getErrors()
      Gets the standard error output.

      Throws TentackleRuntimeException if run method not invoked yet.

      Returns:
      the error lines, never null
    • getErrorsAsString

      public String getErrorsAsString()
      Gets the standard error output.

      Throws TentackleRuntimeException if run method not invoked yet.

      Returns:
      the errors, never null
    • getErrCode

      public int getErrCode()
      Gets the error code.

      Throws TentackleRuntimeException if run method not invoked yet.

      Returns:
      the error, 0 if ok
    • clear

      public void clear()
      Clears arguments and results.