Package org.aksw.iguana.cc.utils
Class CLIProcessManager
- java.lang.Object
-
- org.aksw.iguana.cc.utils.CLIProcessManager
-
public class CLIProcessManager extends java.lang.Object
CLI Utils class
-
-
Constructor Summary
Constructors Constructor Description CLIProcessManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
countLinesUntilStringOccurs(java.lang.Process process, java.lang.String successString, java.lang.String errorString)
Count and returns the no.static java.lang.Process
createProcess(java.lang.String command)
Creates a processstatic java.util.List<java.lang.Process>
createProcesses(int n, java.lang.String command)
Create n processes of the same commandstatic java.lang.Process
destroyAndCreateNewProcess(java.lang.Process process, java.lang.String command)
Short handler for destroyProcess and createProcessstatic void
destroyProcess(java.lang.Process process)
Destroys a process forciblystatic void
executeCommand(java.lang.Process process, java.lang.String command)
static boolean
isReaderReady(java.lang.Process process)
Checks if the process input stream is ready to be read.
-
-
-
Method Detail
-
createProcess
public static java.lang.Process createProcess(java.lang.String command)
Creates a process- Parameters:
command
-- Returns:
-
destroyProcess
public static void destroyProcess(java.lang.Process process)
Destroys a process forcibly- Parameters:
process
-
-
destroyAndCreateNewProcess
public static java.lang.Process destroyAndCreateNewProcess(java.lang.Process process, java.lang.String command)
Short handler for destroyProcess and createProcess- Parameters:
process
-command
-- Returns:
-
createProcesses
public static java.util.List<java.lang.Process> createProcesses(int n, java.lang.String command)
Create n processes of the same command- Parameters:
n
- the amount of processes createdcommand
- the command to create the process with- Returns:
-
countLinesUntilStringOccurs
public static long countLinesUntilStringOccurs(java.lang.Process process, java.lang.String successString, java.lang.String errorString) throws java.io.IOException
Count and returns the no. of lines of one process until a certain string appears,- Parameters:
process
-successString
- the string of the process after the no of line should be returnederrorString
- the error string, will throw an IOException if this appeared.- Returns:
- Throws:
java.io.IOException
-
executeCommand
public static void executeCommand(java.lang.Process process, java.lang.String command) throws java.io.IOException
- Throws:
java.io.IOException
-
isReaderReady
public static boolean isReaderReady(java.lang.Process process) throws java.io.IOException
Checks if the process input stream is ready to be read.- Parameters:
process
-- Returns:
- Throws:
java.io.IOException
-
-