- java.lang.Object
-
- org.tentackle.common.ToolRunner
-
public class ToolRunner extends java.lang.ObjectRunner for external tools.
-
-
Constructor Summary
Constructors Constructor Description ToolRunner(java.io.File tool)Creates a runner for a tool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ToolRunnerarg(java.lang.Object... args)Adds arguments.voidclear()Clears arguments and results.intgetErrCode()Gets the error code.java.util.List<java.lang.String>getErrors()Gets the standard error output.java.lang.StringgetErrorsAsString()Gets the standard error output.java.util.List<java.lang.String>getOutput()Gets the standard output.java.lang.StringgetOutputAsString()Gets the standard output.ToolRunnerrun()Runs the tool.java.lang.StringtoString()
-
-
-
Constructor Detail
-
ToolRunner
public ToolRunner(java.io.File tool)
Creates a runner for a tool.Throws
TentackleRuntimeExceptionif tool not found or not executable.- Parameters:
tool- the tool
-
-
Method Detail
-
arg
public ToolRunner arg(java.lang.Object... args)
Adds arguments.- Parameters:
args- the arguments- Returns:
- this runner
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
run
public ToolRunner run()
Runs the tool.Throws
TentackleRuntimeExceptionif running the tool failed.- Returns:
- this runner
-
getOutput
public java.util.List<java.lang.String> getOutput()
Gets the standard output.- Returns:
- the output lines, never null
-
getOutputAsString
public java.lang.String getOutputAsString()
Gets the standard output.- Returns:
- the output, never null
-
getErrors
public java.util.List<java.lang.String> getErrors()
Gets the standard error output.Throws
TentackleRuntimeExceptionif run method not invoked yet.- Returns:
- the error lines, never null
-
getErrorsAsString
public java.lang.String getErrorsAsString()
Gets the standard error output.Throws
TentackleRuntimeExceptionif run method not invoked yet.- Returns:
- the errors, never null
-
getErrCode
public int getErrCode()
Gets the error code.Throws
TentackleRuntimeExceptionif run method not invoked yet.- Returns:
- the error, 0 if ok
-
clear
public void clear()
Clears arguments and results.
-
-