|
|||||||||
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 | |
---|---|
java.lang.String |
asVersionNumber(float version)
Render version as a version number. |
float |
getVersion(java.lang.String commandPath)
|
static ConsoleTools |
instance()
Get accessor to unique instance. |
java.util.List |
run(java.lang.String[] arguments,
java.io.File path,
int expectedResult)
Runs the specified (shell) command. |
java.util.List |
run(java.lang.String[] arguments,
java.io.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 java.lang.String asVersionNumber(float version)
Float.toString()
, always use a "."
and never a "," independant of the current locale.
public float getVersion(java.lang.String commandPath) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public java.util.List run(java.lang.String[] arguments, java.io.File path, int expectedResult) throws java.io.IOException, java.lang.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
java.io.IOException
- if the exit code is not expectedResult
java.lang.InterruptedException
public java.util.List run(java.lang.String[] arguments, java.io.File path, int expectedResult, ConsoleOutputListener listener) throws java.io.IOException, java.lang.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
java.io.IOException
- if the exit code is not expectedResult
java.lang.InterruptedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |