Documentation of 'com.jstatcom.io.RedirectOutput' Java class
RedirectOutput
com.jstatcom.io

Class RedirectOutput

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable


    public final class RedirectOutput
    extends java.io.PrintStream
    Helper class to redirect stdout and stderr to a log file and/or a receiver component. The redirection also keeps the original streams for System.out and System.err but adds an additional stream.

    Usage Note:
    Redirection is initiated by calling the start method. Subsequent calls to start are allowed to change the file or logging component. The stop method cancels redirection.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static void start(RedirectReceiver receiver)
      Starts redirecting stdout and stderr to a logging component.
      static void start(java.lang.String fileName)
      Starts redirecting stdout and stderr to a log file.
      static void stop()
      Stops redirecting the output and restored previous settings.
      void write(byte[] buf, int off, int len)
      PrintStream overwrite.
      void write(int b)
      PrintStream overwrite.
      • Methods inherited from class java.io.PrintStream

        append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println
      • Methods inherited from class java.io.FilterOutputStream

        write
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • start

        public static void start(java.lang.String fileName)
        Starts redirecting stdout and stderr to a log file.
        Parameters:
        fileName - the name of the log file
        Throws:
        java.lang.IllegalArgumentException - if fileName == null
      • start

        public static void start(RedirectReceiver receiver)
        Starts redirecting stdout and stderr to a logging component.
        Parameters:
        receiver - the name of the receiving component
        Throws:
        java.lang.IllegalArgumentException - if receiver == null
      • stop

        public static void stop()
        Stops redirecting the output and restored previous settings.
      • write

        public void write(byte[] buf,
                          int off,
                          int len)
        PrintStream overwrite.
        Overrides:
        write in class java.io.PrintStream
        Parameters:
        buf - byte[]
        off - int
        len - int
      • write

        public void write(int b)
        PrintStream overwrite.
        Overrides:
        write in class java.io.PrintStream
        Parameters:
        b - int

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.