< prev index next >
./test/lib/jdk/test/lib/process/OutputAnalyzer.java
Print this page
rev 2554 : [mq]: 8180195
@@ -22,10 +22,11 @@
*/
package jdk.test.lib.process;
import java.io.IOException;
+import java.io.PrintStream;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -413,10 +414,29 @@
" exitValue = " + getExitValue() + "\n";
System.err.println(msg);
}
+ /**
+ * Print the stdout buffer to the given {@code PrintStream}.
+ *
+ * @return this OutputAnalyzer
+ */
+ public OutputAnalyzer outputTo(PrintStream out) {
+ out.println(getStdout());
+ return this;
+ }
+
+ /**
+ * Print the stderr buffer to the given {@code PrintStream}.
+ *
+ * @return this OutputAnalyzer
+ */
+ public OutputAnalyzer errorTo(PrintStream out) {
+ out.println(getStderr());
+ return this;
+ }
/**
* Get the contents of the output buffer (stdout and stderr)
*
* @return Content of the output buffer
< prev index next >