All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mike10004.nativehelper.subprocess.ProcessResult Maven / Gradle / Ivy

There is a newer version: 10.0.0
Show newest version
package com.github.mike10004.nativehelper.subprocess;

import java.util.function.Function;

/**
 * Interface representing a process result. A process result is an exit code
 * and an object representing output from the process.
 * @param  type of the captured standard output contents
 * @param  type of the captured standard error contents
 */
public interface ProcessResult {

    int exitCode();

    StreamContent content();

    static  ProcessResult direct(int exitCode, SO stdout, SE stderr) {
        return BasicProcessResult.create(exitCode, stdout, stderr);
    }

    static  ProcessResult direct(int exitCode, StreamContent output) {
        return new BasicProcessResult<>(exitCode, output);
    }

    default  ProcessResult map(Function stdoutMap, Function stderrMap) {
        return new BasicProcessResult<>(exitCode(), content().map(stdoutMap, stderrMap));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy