I have been through the StreamGobbler
and I understand the usage and the reason on why it has been implemented. However the scenarios covered are only those wherein there could be an output from the command / handling errors.
I do not find any scenario wherein StreamGobbler
is used to handle inputs. For example, in mailx
, I have to specify the body of the email, which I have done in the following format
Process proc = Runtime.getRuntime().exec(cmd);
OutputStreamWriter osw = new OutputStreamWriter(proc.getOutputStream());
osw.write(mailBody);
osw.close();
How can this be handled through StreamGobbler
, or it is not required to be handled through it?
mailx
command. But as a failsafe should I include it? Also regarding the mailbody which I have mentioned above, this would not be part of the StreamGobbler right ? – Durr