All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dlib.Deferred_PrintStream

java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.PrintWriter
                   |
                   +----dlib.Deferred_PrintStream

public class Deferred_PrintStream
extends PrintWriter
Provides a PrintWriter object, which will create and expose a console window if it is used. The intention of this class is to provide an "emergency console" for use in situations where there normally should be no output to the console, and/or where output to the console would be hard to see. A good example of this is applets running under Microsoft Internet Explorer: normally, output just disappears.

Suggested usage:
System.out = new Deferred_PrintStream("window name");

If the console window has been opened (probably by output) and closed (probably by the user); then subsequent output will create a new window.

To gracefully synchronize closing the console window with exiting the program, use the Always_Wait_For_Finish method.

Implementation Note

This class works by shadowing every one of PrintWriter's public methods, which is pretty ugly, but the only way to do this in Java. In more elegant languages, it is possible to create a class that implements all methods through a default handler, and passes them all on to the desired client.


Constructor Index

 o Deferred_PrintStream()
create a new PrintWriter, which will create a ConsoleWindow if any output is performed.
 o Deferred_PrintStream(String)
create a named new PrintStream, which will create a ConsoleWindow if any output is performed.

Method Index

 o Active()
returns true if the console window has been activated and is visible
 o Always_Wait_For_Finish()
unconsitionally wait for the console window to be closed
 o checkError()
 o close()
 o flush()
 o main(String[])
 o print(boolean)
 o print(char)
 o print(char[])
 o print(double)
 o print(float)
 o print(int)
 o print(long)
 o print(Object)
 o print(String)
 o println(boolean)
 o println(char)
 o println(char[])
 o println(double)
 o println(float)
 o println(int)
 o println(long)
 o println(Object)
 o println(String)
 o Wait_For_Finish()
wait until the console window has been closed (or was never opened)
 o write(char[])
 o write(char[], int, int)
 o write(int)
 o write(String)
 o write(String, int, int)

Constructors

 o Deferred_PrintStream
 public Deferred_PrintStream()
create a new PrintWriter, which will create a ConsoleWindow if any output is performed.

 o Deferred_PrintStream
 public Deferred_PrintStream(String name)
create a named new PrintStream, which will create a ConsoleWindow if any output is performed.

Methods

 o Active
 public boolean Active()
returns true if the console window has been activated and is visible

 o Wait_For_Finish
 public void Wait_For_Finish() throws InterruptedException
wait until the console window has been closed (or was never opened)

 o Always_Wait_For_Finish
 public void Always_Wait_For_Finish()
unconsitionally wait for the console window to be closed

 o checkError
 public boolean checkError()
Overrides:
checkError in class PrintWriter
 o close
 public void close()
Overrides:
close in class PrintWriter
 o flush
 public void flush()
Overrides:
flush in class PrintWriter
 o print
 public void print(boolean b)
Overrides:
print in class PrintWriter
 o print
 public void print(char c)
Overrides:
print in class PrintWriter
 o print
 public void print(char s[])
Overrides:
print in class PrintWriter
 o print
 public void print(double d)
Overrides:
print in class PrintWriter
 o print
 public void print(float f)
Overrides:
print in class PrintWriter
 o print
 public void print(int i)
Overrides:
print in class PrintWriter
 o print
 public void print(long l)
Overrides:
print in class PrintWriter
 o print
 public void print(Object obj)
Overrides:
print in class PrintWriter
 o print
 public void print(String s)
Overrides:
print in class PrintWriter
 o println
 public void println(boolean b)
Overrides:
println in class PrintWriter
 o println
 public void println(char c)
Overrides:
println in class PrintWriter
 o println
 public void println(char s[])
Overrides:
println in class PrintWriter
 o println
 public void println(double d)
Overrides:
println in class PrintWriter
 o println
 public void println(float f)
Overrides:
println in class PrintWriter
 o println
 public void println(int i)
Overrides:
println in class PrintWriter
 o println
 public void println(long l)
Overrides:
println in class PrintWriter
 o println
 public void println(Object obj)
Overrides:
println in class PrintWriter
 o println
 public void println(String s)
Overrides:
println in class PrintWriter
 o write
 public void write(String b,
                   int off,
                   int len)
Overrides:
write in class PrintWriter
 o write
 public void write(String b)
Overrides:
write in class PrintWriter
 o write
 public void write(char b[],
                   int off,
                   int len)
Overrides:
write in class PrintWriter
 o write
 public void write(int i)
Overrides:
write in class PrintWriter
 o write
 public void write(char b[])
Overrides:
write in class PrintWriter
 o main
 public static void main(String arg[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index