Package it.tidalwave.util
Interface ProcessExecutor.ConsoleOutput
-
- Enclosing interface:
- ProcessExecutor
public static interface ProcessExecutor.ConsoleOutput
A container of the console output of the process.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Clears the contents collected so far.java.util.Scanner
filteredAndSplitBy(java.lang.String filterRegexp, java.lang.String delimiterRegexp)
Returns aScanner
on 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()
void
read()
Reads the output until it's completed.ProcessExecutor.ConsoleOutput
start()
Starts collection output from the external process.ProcessExecutor.ConsoleOutput
waitFor(java.lang.String regexp)
Waits for an output line matching the given regular expression to appear.ProcessExecutor.ConsoleOutput
waitForCompleted()
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 aScanner
on the latest line of output produced that matches a given regular expression, split on the given delimiter. Remember that theScanner
must be closed when done.- Parameters:
filterRegexp
- the regular expression to filter outputdelimiterRegexp
- the regular expression to split the line- Returns:
- the
Scanner
to 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()
-
-