|
|||||||||
| Home >> All >> jpicedt >> ui >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
jpicedt.ui.util
Class SystemOutUtilities

java.lang.Objectjpicedt.ui.util.SystemOutUtilities
- public class SystemOutUtilities
- extends java.lang.Object
A class that allow redirection of stderr and/or stdout to a log file. Invokation of this class must be done with "SystemOutUtilities.instance()" which return a reference to the singleton.
- Since:
- PicEdt 1.3
| Nested Class Summary | |
(package private) class |
SystemOutUtilities.ListenerThread
the watchdog thread that periodically listens to incoming error messages (currently set to 3") then writes them to file and/or to a JTextArea (see inner class SystemOutToFrame) kill it by setting "lt = null" |
(package private) class |
SystemOutUtilities.SystemOutToFrame
A JDialog box which is used to display error message in a JTextPane or to a file. |
| Field Summary | |
private java.io.BufferedReader |
bufReader
|
private int |
currentRedir
|
private static boolean |
DEBUG
|
private boolean |
displayDialog
|
static int |
FILE
redirects stdout to a file named "jPicedtError.log" |
private SystemOutUtilities.ListenerThread |
lt
|
private java.io.PrintStream |
newSystemOut
|
private java.io.PrintStream |
oldSystemErr
|
private java.io.PrintStream |
oldSystemOut
|
private static SystemOutUtilities |
singleton
|
static int |
STANDARD
doesn't redirect stdout to a file, i.e. |
private SystemOutUtilities.SystemOutToFrame |
systemOutToFrameInstance
|
private java.io.PrintStream |
toFilePrintStream
|
| Constructor Summary | |
private |
SystemOutUtilities()
constructor is protected since the only way to access this class is by using SystemOutUtilities.instance() |
| Method Summary | |
void |
displayDialog(boolean state)
Sets the "displayDialog" flag, i.e. |
static java.lang.String |
getErrorLogFile()
Return the path to error.log |
static SystemOutUtilities |
instance()
intanciates singleton if it's null, then returns it |
void |
redirect(int type)
Redirect to the stream of the given type |
private void |
redirectSystemOutToFile()
Redirect System.out to a file named "jPicEdtError.log" located in user's home directory - displayDialog = false by default (i.e. |
private void |
stopSystemOutToFileRedirection()
After a redirection to a pipe, sets back System.out and System.err to their default value |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
STANDARD
public static final int STANDARD
- doesn't redirect stdout to a file, i.e. redirect to console ; instead open a frame and displays the error message in it
- See Also:
- Constant Field Values
FILE
public static final int FILE
- redirects stdout to a file named "jPicedtError.log"
- See Also:
- Constant Field Values
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
singleton
private static SystemOutUtilities singleton
currentRedir
private int currentRedir
oldSystemOut
private java.io.PrintStream oldSystemOut
newSystemOut
private java.io.PrintStream newSystemOut
oldSystemErr
private java.io.PrintStream oldSystemErr
bufReader
private java.io.BufferedReader bufReader
toFilePrintStream
private java.io.PrintStream toFilePrintStream
lt
private SystemOutUtilities.ListenerThread lt
displayDialog
private boolean displayDialog
systemOutToFrameInstance
private SystemOutUtilities.SystemOutToFrame systemOutToFrameInstance
| Constructor Detail |
SystemOutUtilities
private SystemOutUtilities()
- constructor is protected since the only way to access this class is by using SystemOutUtilities.instance()
| Method Detail |
instance
public static SystemOutUtilities instance()
- intanciates singleton if it's null, then returns it
redirect
public void redirect(int type)
- Redirect to the stream of the given type
displayDialog
public void displayDialog(boolean state)
- Sets the "displayDialog" flag, i.e. what must happen when an error message comes up and redir=FILE : do we open a JDialog
or simply write the error message to the log file ?
(obviously, calling this method if redir=STANDARD simply makes no sense)
redirectSystemOutToFile
private void redirectSystemOutToFile()
- Redirect System.out to a file named "jPicEdtError.log" located in user's home directory
- displayDialog = false by default (i.e. no dialog box gets opened when an error message occurs)
- we init "toFilePrintStream" so that it points to "user's setting dir/error.log"
- we set System.out to this stream (redirection)
getErrorLogFile
public static java.lang.String getErrorLogFile()
- Return the path to error.log
stopSystemOutToFileRedirection
private void stopSystemOutToFileRedirection()
- After a redirection to a pipe, sets back System.out and System.err to their default value
|
|||||||||
| Home >> All >> jpicedt >> ui >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
jpicedt.ui.util.SystemOutUtilities