Class DefaultCommandProcess

    • Constructor Detail

      • DefaultCommandProcess

        public DefaultCommandProcess​(InputStream is,
                                     OutputStream os,
                                     InputStream err)
        Create process.
        Parameters:
        is - Input stream.
        os - Output stream.
        err - Error stream.
    • Method Detail

      • read

        public String read()
                    throws IOException
        Description copied from interface: CommandProcess
        Read output until a null line is read.
        Since command process will not be closed, a simple string is returned (an exit status cannot be computed).
        Specified by:
        read in interface CommandProcess
        Returns:
        Command result.
        Throws:
        IOException - If an error occurred during operation.
      • read

        public String read​(OutputHandler handler)
                    throws IOException
        Description copied from interface: CommandProcess
        Read output until:
        • A null line is read.
        • Handler returns false when line is read.
        Since command process will not be closed, a simple string is returned (an exit status cannot be computed).
        Specified by:
        read in interface CommandProcess
        Parameters:
        handler - Output handler.
        Returns:
        Full output.
        Throws:
        IOException - If an error occurred during operation.
      • write

        public void write​(String input,
                          String... others)
                   throws IOException
        Description copied from interface: CommandProcess
        Write input string to the current process.
        Specified by:
        write in interface CommandProcess
        Parameters:
        input - Input.
        others - Other inputs.
        Throws:
        IOException - If an error occurred during operation.
      • isRunning

        public boolean isRunning()
        Description copied from interface: CommandProcess
        Check if current process is still opened. If this method returns true, then CommandProcess.isClosed() should return false.
        Specified by:
        isRunning in interface CommandProcess
        Returns:
        true if process is open, false otherwise.
      • isClosed

        public boolean isClosed()
        Description copied from interface: CommandProcess
        Check if current process has been closed. If this method returns true, then CommandProcess.isRunning() should return false.
        Specified by:
        isClosed in interface CommandProcess
        Returns:
        true if process is closed, false otherwise.