Package it.tidalwave.util
Interface ProcessExecutor.ConsoleOutput
-
- Enclosing interface:
- ProcessExecutor
public static interface ProcessExecutor.ConsoleOutputA container of the console output of the process.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears the contents collected so far.java.util.ScannerfilteredAndSplitBy(java.lang.String filterRegexp, java.lang.String delimiterRegexp)Returns aScanneron the latest line of output produced that matches a given regular expression, split on the given delimiter.java.util.List<java.lang.String>filteredBy(java.lang.String filterRegexp)Returns the output produced by the launched process, filtered by the given regular expression.java.util.List<java.lang.String>getContent()voidread()Reads the output until it's completed.ProcessExecutor.ConsoleOutputstart()Starts collection output from the external process.ProcessExecutor.ConsoleOutputwaitFor(java.lang.String regexp)Waits for an output line matching the given regular expression to appear.ProcessExecutor.ConsoleOutputwaitForCompleted()Waits for the completion of the launched process.
-
-
-
Method Detail
-
start
@Nonnull ProcessExecutor.ConsoleOutput start()
Starts collection output from the external process.- Returns:
- itself
-
waitForCompleted
@Nonnull ProcessExecutor.ConsoleOutput waitForCompleted() throws java.lang.InterruptedException
Waits for the completion of the launched process.- Returns:
- itself
- Throws:
java.lang.InterruptedException- if the process was interrupted
-
filteredAndSplitBy
@Nonnull java.util.Scanner filteredAndSplitBy(@Nonnull java.lang.String filterRegexp, @Nonnull java.lang.String delimiterRegexp)Returns aScanneron the latest line of output produced that matches a given regular expression, split on the given delimiter. Remember that theScannermust be closed when done.- Parameters:
filterRegexp- the regular expression to filter outputdelimiterRegexp- the regular expression to split the line- Returns:
- the
Scannerto parse results
-
filteredBy
@Nonnull java.util.List<java.lang.String> filteredBy(@Nonnull java.lang.String filterRegexp)Returns the output produced by the launched process, filtered by the given regular expression.- Parameters:
filterRegexp- the regular expression to filter output- Returns:
- the output lines
-
waitFor
@Nonnull ProcessExecutor.ConsoleOutput waitFor(@Nonnull java.lang.String regexp) throws java.lang.InterruptedException, java.io.IOException
Waits for an output line matching the given regular expression to appear.- Parameters:
regexp- the regular expression- Returns:
- itself
- Throws:
java.io.IOException- if something goes wrongjava.lang.InterruptedException- if the process has been interrupted
-
clear
void clear()
Clears the contents collected so far.
-
read
void read() throws java.io.IOException
Reads the output until it's completed.- Throws:
java.io.IOException
-
getContent
@Nonnull java.util.List<java.lang.String> getContent()
-
-