I have a Java program that outputs some text into console. It uses print
, println
, and some other methods to do this.
At the end of the program , I want to read all the text in console and copy it into a String buffer. How could I do this in Java ? I need to read stdout
and stderr
separately.