Class DefaultProcessExecutor.DefaultConsoleOutput

java.lang.Object
it.tidalwave.util.spi.DefaultProcessExecutor.DefaultConsoleOutput
All Implemented Interfaces:
ProcessExecutor.ConsoleOutput
Enclosing class:
DefaultProcessExecutor

public class DefaultProcessExecutor.DefaultConsoleOutput extends Object implements ProcessExecutor.ConsoleOutput
  • Constructor Details

    • DefaultConsoleOutput

      public DefaultConsoleOutput()
  • Method Details

    • start

      @Nonnull public ProcessExecutor.ConsoleOutput start()
      Should not be used by the programmer.
      Returns:
      -
    • latestLineMatches

      public boolean latestLineMatches(@Nonnull String regexp)
      Returns true if the latest received line matches the given regular expression.
      Specified by:
      latestLineMatches in interface ProcessExecutor.ConsoleOutput
      Parameters:
      regexp - the regular expression
      Returns:
      true in case of match
    • filteredAndSplitBy

      @Nonnull public Scanner filteredAndSplitBy(@Nonnull String filterRegexp, @Nonnull String delimiterRegexp)
      Returns a Scanner over the latest line matching a given regular expression, with the specific delimiter regular expression.
      Specified by:
      filteredAndSplitBy in interface ProcessExecutor.ConsoleOutput
      Parameters:
      filterRegexp - the regular expression for the filter
      delimiterRegexp - the regular expression for the Scanner
      Returns:
      the list of matching lines
    • filteredBy

      @Nonnull public List<String> filteredBy(@Nonnull String regexp)
      Returns a list of lines that match the given regular expression.
      Specified by:
      filteredBy in interface ProcessExecutor.ConsoleOutput
      Parameters:
      regexp - the regular expression
      Returns:
      the list of matching lines
    • waitFor

      @Nonnull public ProcessExecutor.ConsoleOutput waitFor(@Nonnull String regexp) throws InterruptedException, IOException
      Waits for a line matching the given regular expression to appear.
      Specified by:
      waitFor in interface ProcessExecutor.ConsoleOutput
      Parameters:
      regexp - the regular expression
      Returns:
      itself for chaining methods
      Throws:
      InterruptedException - if the wait has been interrupted
      IOException - in case the process has terminated or another I/O error
    • clear

      public void clear()
      Clears the buffer of lines. This means that no filtering or waiting operation can be performed on the output produced so far. It will be possible to perform further operations on the output produced from now on.
      Specified by:
      clear in interface ProcessExecutor.ConsoleOutput