|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
com.jstatcom.io.RedirectOutput
public final class RedirectOutput
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 | |
|---|---|
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 |
|---|
public static void start(java.lang.String fileName)
fileName - the name of the log file
java.lang.IllegalArgumentException - if fileName == nullpublic static void start(RedirectReceiver receiver)
receiver - the name of the receiving component
java.lang.IllegalArgumentException - if receiver == nullpublic static void stop()
public void write(byte[] buf,
int off,
int len)
write in class java.io.PrintStreambuf - byte[]off - intlen - intpublic void write(int b)
write in class java.io.PrintStreamb - int
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||