title: Capturing contents of standard output in Java
body: <p>I am invoking a function that is printing some string in my console/standard output. I need to capture this string. I cannot modify the function that is doing the printing, nor change runtime behavior through inheritance. I am unable to find any pre-defined methods that will allow me to do this.</p>
  
  <p>Does the JVM store a buffer of printed contents?</p>
  
  <p>Does anyone know of a Java method that will aid me?</p>