|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jomic.tools.ConsoleTools
public final class ConsoleTools
Utility methods to interact with command line interface.
| Field Summary | |
|---|---|
static int |
NO_RESULT
Pseudo exit code indicating that exit code does not matter. |
| Method Summary | |
|---|---|
String |
asVersionNumber(float version)
Render version as a version number. |
float |
getVersion(String commandPath)
|
static ConsoleTools |
instance()
Get accessor to unique instance. |
List |
run(String[] arguments,
File path,
int expectedResult)
Runs the specified (shell) command. |
List |
run(String[] arguments,
File path,
int expectedResult,
ConsoleOutputListener listener)
Runs the specified (shell) command. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_RESULT
| Method Detail |
|---|
public static ConsoleTools instance()
public String asVersionNumber(float version)
Float.toString(), always use a "."
and never a "," independant of the current locale.
public float getVersion(String commandPath)
throws IOException,
InterruptedException
IOException
InterruptedException
public List run(String[] arguments,
File path,
int expectedResult)
throws IOException,
InterruptedException
arguments - arguments[0] is the actual command, all other entries are the
arguments passed to itpath - the current directory in which the command is to be executed;
if null, use property "user.dir" (the current working directory)expectedResult - the expected exit code; typically 0 to indicate a successful
run
System.out and System.err
by the command
IOException - if the exit code is not expectedResult
InterruptedException
public List run(String[] arguments,
File path,
int expectedResult,
ConsoleOutputListener listener)
throws IOException,
InterruptedException
arguments - arguments[0] is the actual command, all other entries are the
arguments passed to itpath - the current directory in which the command is to be executed;
if null, use the current working directory (as specified by System.getProperty("user.dir")
)expectedResult - the expected exit code; typically 0 to indicate a successful
run. NO_RESULT means that the exit code should be ignored.listener - to be informed about every line written to System.out
or Syst.err
System.out and System.err
by the command
IOException - if the exit code is not expectedResult
InterruptedException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||