Here is a snipped code of my problem:
Process process = Runtime.getRuntime().exec(command);
if (process.waitFor() != 0)
throw new Exception("error");
reader =
new BufferedReader(new InputStreamReader(process.getInputStream()));
The running process is producing a huge output. If i redirect the output to a file, the process terminates quicker then printing the output on screen (standard output). I do not wish to redirect the output to a file, due to low performance of the disk, filesystem permission, etc..
When process.waitFor() is executed, Java is being blocked until the process (callee) is terminated, and that can take a long time. So in order to bypass this issue, I would like to redirect the process' standard output to reader's stream input (last line at the code). i.e., the callee should produce an output to a stream linked with the reader, instead to print the output on screen.
Hope I was clear enough. I wonder how may I do that? Any assistance will be great.