Class StdoutReader


  • public final class StdoutReader
    extends Object
    Reads to contents of an InputStream in an background thread, useful to retrieve OutputStream/ErrorStream of a Process, and allows retrieval as String representing a line of the output.
    • Method Detail

      • createAndRunAsyncReader

        public static StdoutReader createAndRunAsyncReader​(InputStream inputStream)
        Creates a new StdoutReader starting to read the data immediately of the given InputStream in an own thread.
        Parameters:
        inputStream - InputStream to read the data from
        Returns:
        a reader for the given input stream
      • readLine

        public String readLine()
        Retrieve the next line from the bufered InputStream.
        Returns:
        next line of InputStream, if no new data is available empty or null if InputStream is closed.
      • readContent

        public String readContent()
        Retrieve the whole content currently buffered, empty lines are suppressed.
        Returns:
        all read lines, if no new data is available empty or null if InputStream is closed.