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.
-
Deferred_PrintStream()
- create a new PrintWriter, which will create a ConsoleWindow if any
output is performed.
-
Deferred_PrintStream(String)
- create a named new PrintStream, which will create a ConsoleWindow if any
output is performed.
-
Active()
- returns true if the console window has been activated and is visible
-
Always_Wait_For_Finish()
- unconsitionally wait for the console window to be closed
-
checkError()
-
-
close()
-
-
flush()
-
-
main(String[])
-
-
print(boolean)
-
-
print(char)
-
-
print(char[])
-
-
print(double)
-
-
print(float)
-
-
print(int)
-
-
print(long)
-
-
print(Object)
-
-
print(String)
-
-
println(boolean)
-
-
println(char)
-
-
println(char[])
-
-
println(double)
-
-
println(float)
-
-
println(int)
-
-
println(long)
-
-
println(Object)
-
-
println(String)
-
-
Wait_For_Finish()
- wait until the console window has been closed (or was never opened)
-
write(char[])
-
-
write(char[], int, int)
-
-
write(int)
-
-
write(String)
-
-
write(String, int, int)
-
Deferred_PrintStream
public Deferred_PrintStream()
- create a new PrintWriter, which will create a ConsoleWindow if any
output is performed.
Deferred_PrintStream
public Deferred_PrintStream(String name)
- create a named new PrintStream, which will create a ConsoleWindow if any
output is performed.
Active
public boolean Active()
- returns true if the console window has been activated and is visible
Wait_For_Finish
public void Wait_For_Finish() throws InterruptedException
- wait until the console window has been closed (or was never opened)
Always_Wait_For_Finish
public void Always_Wait_For_Finish()
- unconsitionally wait for the console window to be closed
checkError
public boolean checkError()
- Overrides:
- checkError in class PrintWriter
close
public void close()
- Overrides:
- close in class PrintWriter
flush
public void flush()
- Overrides:
- flush in class PrintWriter
print
public void print(boolean b)
- Overrides:
- print in class PrintWriter
print
public void print(char c)
- Overrides:
- print in class PrintWriter
print
public void print(char s[])
- Overrides:
- print in class PrintWriter
print
public void print(double d)
- Overrides:
- print in class PrintWriter
print
public void print(float f)
- Overrides:
- print in class PrintWriter
print
public void print(int i)
- Overrides:
- print in class PrintWriter
print
public void print(long l)
- Overrides:
- print in class PrintWriter
print
public void print(Object obj)
- Overrides:
- print in class PrintWriter
print
public void print(String s)
- Overrides:
- print in class PrintWriter
println
public void println(boolean b)
- Overrides:
- println in class PrintWriter
println
public void println(char c)
- Overrides:
- println in class PrintWriter
println
public void println(char s[])
- Overrides:
- println in class PrintWriter
println
public void println(double d)
- Overrides:
- println in class PrintWriter
println
public void println(float f)
- Overrides:
- println in class PrintWriter
println
public void println(int i)
- Overrides:
- println in class PrintWriter
println
public void println(long l)
- Overrides:
- println in class PrintWriter
println
public void println(Object obj)
- Overrides:
- println in class PrintWriter
println
public void println(String s)
- Overrides:
- println in class PrintWriter
write
public void write(String b,
int off,
int len)
- Overrides:
- write in class PrintWriter
write
public void write(String b)
- Overrides:
- write in class PrintWriter
write
public void write(char b[],
int off,
int len)
- Overrides:
- write in class PrintWriter
write
public void write(int i)
- Overrides:
- write in class PrintWriter
write
public void write(char b[])
- Overrides:
- write in class PrintWriter
main
public static void main(String arg[])
All Packages Class Hierarchy This Package Previous Next Index