Class OutputCatcher


  • public class OutputCatcher
    extends java.lang.Object
    A tool to capture the output of System.out and System.err. The regular output still occurs, but it is additionally available as a String.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String START_ERROR
      The HTML text will contain this string if something was written to System.err.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static OutputCatcher start()
      Create a new output catcher and start it.
      void stop()
      Stop catching output.
      void writeTo​(java.lang.String title, java.lang.String fileName)
      Write the output to a HTML file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • START_ERROR

        public static final java.lang.String START_ERROR
        The HTML text will contain this string if something was written to System.err.
        See Also:
        Constant Field Values
    • Method Detail

      • stop

        public void stop()
        Stop catching output.
      • writeTo

        public void writeTo​(java.lang.String title,
                            java.lang.String fileName)
                     throws java.io.IOException
        Write the output to a HTML file.
        Parameters:
        title - the title
        fileName - the file name
        Throws:
        java.io.IOException
      • start

        public static OutputCatcher start()
        Create a new output catcher and start it.
        Returns:
        the output catcher