Exit Full View

Feather2 / feather2-runtime / src / main / java / uk / co / nickthecoder / feather / runtime / command / Consumer.java

package uk.co.nickthecoder.feather.runtime.command;

/**
 * Consumes output from a Command.
 * This is useful when running commands that produce a lot of output, and you want to process it in a
 * stream-like fashion.
 * See CommandRunner.run( Consumer, Consumer ).
 * <p>
 * For commands which produce little output, it is simpler to use CommandRunner.collect() which
 * consumes the output, and places it all into a String. See CommandResult.out and CommandResult.err.
 * <p>
 * If you don't care about the output at all, then you could use CommandRunner.run().
 * In which case, any output is streamed to the existing stdout/stderr of the calling process.
 *
 */
public interface Consumer {

    void consume(char[] buffer, int chars);

}