com.github.mike10004.nativehelper.subprocess.StreamContent Maven / Gradle / Ivy
package com.github.mike10004.nativehelper.subprocess;
import com.github.mike10004.nativehelper.subprocess.StreamContents.MappedOutput;
import java.util.function.Function;
/**
* Interface defining methods for obtaining the captured content of
* standard output and error streams of a process.
* @param type of captured standard output contents
* @param type of captured standard error contents
*/
public interface StreamContent {
/**
* Returns the content written to standard output by a process.
* @return the standard output content
*/
SO stdout();
/**
* Returns the content written to standard error by a process.
* @return the standard error content
*/
SE stderr();
static StreamContent direct(SO stdout, SE stderr) {
return new StreamContents.DirectOutput<>(stdout, stderr);
}
default StreamContent map(Function super SO, SO2> stdoutMap, Function super SE, SE2> stderrMap) {
return new MappedOutput<>(this, stdoutMap, stderrMap);
}
static StreamContent empty() {
return StreamContents.bothNull();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy