Process4JsonStream p = Process4String.creator
.commad(theCommandToRun)
.environment(envvars)
.workingDir(dir)
.readTimeOut(millisecs)
.writeTimeOut(millisecs)
.terminationTimeOut(millisecs)
.abortTimeOut(millisecs)
.stderrTo(System.out)
.someOtherSettings()
.create();
p.send(myJsonString);
String result = p.receive();
// ... more back and forth.
int exitCode = p.stop();
For special types to create, a specialised builder can be used that allows to set type-specific
options, e.g. for the JsonStrem we could pass the object mapper.
If we would implement a whole protocol for each class and not just the way how to exchange data, then things may be even easier for the user, BUT we would be forced to only connect to processes which use the same protocol, by using the appropriate java or python client library. There are just too many ways how to do this, so we decide: no implementation of a specific protocol!
E.g.