Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpicedt.ui.util
Class SystemOutUtilities

    java.lang.Object
      jpicedt.ui.util.SystemOutUtilities

public class SystemOutUtilities
extends 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
Version:
  $Id: SystemOutUtilities.java,v 1.7.2.1 2007/09/02 11:56:30 reynal Exp $
Author:
  Sylvain Reynal

Field Summary
`static int` | `FILE` redirects stdout to a file named "jPicedtError.log"
`static int` | `STANDARD` doesn't redirect stdout to a file, ie redirect to console ; instead open a frame and displays the error message in it

Method Summary
`void` | `displayDialog(boolean state)` Sets the "displayDialog" flag, ie 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)
`static 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

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, ie 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

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

  Parameters:
    `type` - one of the predefinite SystemOutUtilities's redirection types

### displayDialog

    public void displayDialog(boolean state)

  Sets the "displayDialog" flag, ie 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)

  Parameters:
    `state` - if currentRedir = FILE and : - state==TRUE, enables opening a dialog box whenever some String is written to System.out A "watchdog" Thread is created for that purpose : System.out is redirected to a pipe, which the Thread watches periodically. - state==FALSE, redirect System.out directly to the "toFilePrintStream" FOS, and kill the watchdog Thread if it's still alive. Otherwise (ie currentRedir = STANDARD), we do nothing.

### getErrorLogFile

    public static String getErrorLogFile()

  Return the path to error.log

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org