monitor
Class MonitorManager

java.lang.Object
  extended by monitor.MonitorManager

public class MonitorManager
extends java.lang.Object

This class manages input output streams. Here, you can set(get) any defualt IO and error outputs. It is advised to use the setMonitorAsDefaultErrorOutput() method in the start of every program, to see clearly and save all Exceptions. For Example: //Start main.. public static void main(String [] args)throws Exception{ MonitorManager.setMonitorAsDefaultErrorOutput(); int x=5/0; }//end main.. ///////////Start Output://///// java.lang.ArithmeticException: / by zero at .main(.java:100) //////////End Output/////////// Another conveniant way if you are programming in non swing application. set the monitor to be the default IO and error output. This will empower your program to use interesting methods not applicable to the Dos screen like clear(). After the main method insert this before anything you code:

                        MonitorManager.setMonitorAsDefaultSystemIO();

 to capture input continue with you programming normally:
                        BufferredReader input=new BufferedReader(
                                                                        new InputStreamReader(System.in));
                        input.readLine();
                        
Test it you will like. The best thing about this is that you can insert this statement even in your old programs with out any extra effort to modify anything! Just one method call is enough to do the trick!

Author:
حسام الملحم Hussam Al-Mulhim
See Also:
Monitor

Method Summary
static java.io.PrintStream getDefaultErrorPrintStream()
          Returns the default Dos screen error PrintStream Note that it does not mean that it equals System.err Because System.err could have been changed previously.
static java.io.InputStream getDefaultInputStream()
          Returns the default Dos screen InputStream Note that it does not mean that it equals System.in Because System.in could have been changed previously.
static Monitor getDefaultMonitor()
          Returns the default monitor.
static java.io.PrintStream getDefaultOutputPrintStream()
          Returns the default Dos screen PrintStream Note that it does not mean that it equals System.out Because System.out could have been changed previously.
static void main(java.lang.String[] args)
          Just to test.
static void setDefaultErrorOutput()
          Automatically sets the default error output to the DOS screen output.
static void setDefaultInput()
          Automatically sets the default input DOS screen input.
static void setDefaultOutput()
          Automatically sets the default output to the DOS screen output.
static void setDefaultSystemOutput()
          Automatically sets the default output and the default error output to the DOS screen output.
static void setMonitorAsDefaultErrorOutput()
          Automatically sets a monitor as the default error output.
static void setMonitorAsDefaultErrorOutput(Monitor monitor)
          Sets the given monitor as the default error output.
static void setMonitorAsDefaultInput(Monitor monitor)
          Sets the given monitor as the default input.
static void setMonitorAsDefaultIO()
          Automatically sets the given monitor as the default output & default error output and default input.
static void setMonitorAsDefaultIO(Monitor monitor)
          Sets the given monitor as the default output & default error output and default input.
static void setMonitorAsDefaultOutput()
          Automatically sets a monitor as the default output.
static void setMonitorAsDefaultOutput(Monitor monitor)
          Sets the given monitor as the default output.
static void setMonitorAsDefaultSystemIO()
          Automatically sets the default output & the default error output to the DOS screen output and the default input to the Dos screen input.
static void setMonitorAsDefaultSystemOutput()
          Automatically sets the given monitor as the default output and default error output.
static void setMonitorAsDefaultSystemOutput(Monitor monitor)
          Sets the given monitor as the default output and default error output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setMonitorAsDefaultOutput

public static void setMonitorAsDefaultOutput(Monitor monitor)
                                      throws java.lang.SecurityException
Sets the given monitor as the default output.

Throws:
java.lang.SecurityException

setMonitorAsDefaultErrorOutput

public static void setMonitorAsDefaultErrorOutput(Monitor monitor)
                                           throws java.lang.SecurityException
Sets the given monitor as the default error output.

Throws:
java.lang.SecurityException

setMonitorAsDefaultInput

public static void setMonitorAsDefaultInput(Monitor monitor)
                                     throws java.lang.SecurityException
Sets the given monitor as the default input.

Throws:
java.lang.SecurityException

setMonitorAsDefaultSystemOutput

public static void setMonitorAsDefaultSystemOutput(Monitor monitor)
                                            throws java.lang.SecurityException
Sets the given monitor as the default output and default error output.

Throws:
java.lang.SecurityException

setMonitorAsDefaultIO

public static void setMonitorAsDefaultIO(Monitor monitor)
                                  throws java.lang.SecurityException
Sets the given monitor as the default output & default error output and default input.

Throws:
java.lang.SecurityException

setMonitorAsDefaultOutput

public static void setMonitorAsDefaultOutput()
                                      throws java.lang.SecurityException
Automatically sets a monitor as the default output.

Throws:
java.lang.SecurityException

setMonitorAsDefaultErrorOutput

public static void setMonitorAsDefaultErrorOutput()
                                           throws java.lang.SecurityException
Automatically sets a monitor as the default error output.

Throws:
java.lang.SecurityException

setMonitorAsDefaultSystemOutput

public static void setMonitorAsDefaultSystemOutput()
                                            throws java.lang.SecurityException
Automatically sets the given monitor as the default output and default error output.

Throws:
java.lang.SecurityException

setMonitorAsDefaultIO

public static void setMonitorAsDefaultIO()
                                  throws java.lang.SecurityException
Automatically sets the given monitor as the default output & default error output and default input.

Throws:
java.lang.SecurityException

getDefaultMonitor

public static Monitor getDefaultMonitor()
Returns the default monitor.


getDefaultOutputPrintStream

public static java.io.PrintStream getDefaultOutputPrintStream()
Returns the default Dos screen PrintStream Note that it does not mean that it equals System.out Because System.out could have been changed previously. This method will always return the Dos PrintStream


getDefaultErrorPrintStream

public static java.io.PrintStream getDefaultErrorPrintStream()
Returns the default Dos screen error PrintStream Note that it does not mean that it equals System.err Because System.err could have been changed previously. This method will always return the Dos error PrintStream


getDefaultInputStream

public static java.io.InputStream getDefaultInputStream()
Returns the default Dos screen InputStream Note that it does not mean that it equals System.in Because System.in could have been changed previously. This method will always return the Dos inputStream


setDefaultOutput

public static void setDefaultOutput()
                             throws java.lang.SecurityException
Automatically sets the default output to the DOS screen output.

Throws:
java.lang.SecurityException

setDefaultErrorOutput

public static void setDefaultErrorOutput()
                                  throws java.lang.SecurityException
Automatically sets the default error output to the DOS screen output.

Throws:
java.lang.SecurityException

setDefaultInput

public static void setDefaultInput()
                            throws java.lang.SecurityException
Automatically sets the default input DOS screen input.

Throws:
java.lang.SecurityException

setDefaultSystemOutput

public static void setDefaultSystemOutput()
                                   throws java.lang.SecurityException
Automatically sets the default output and the default error output to the DOS screen output.

Throws:
java.lang.SecurityException

setMonitorAsDefaultSystemIO

public static void setMonitorAsDefaultSystemIO()
Automatically sets the default output & the default error output to the DOS screen output and the default input to the Dos screen input.


main

public static void main(java.lang.String[] args)
Just to test.