jpiv2
Class SystemOutStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by jpiv2.SystemOutStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class SystemOutStream
extends java.io.PrintStream

This class is used to copy system output to a jpiv2.CmdFrame. To catch the System output, do someting like this:
// creating a new CmdFrame
cmdFrame = new jpiv2.CmdFrame(this);
// creating a new SystemOutStream object from standard out
jpiv2.SystemOutStream out = new jpiv.SystemOutStream(System.out);
// assigning the CmdFrame to the new SystemOutStream object
out.assignCmdFrame(cmdFrame);
// redirecting standard output to the new PrintStream object
System.setOut(out);

jpiv2.SystemOutStream is a PrintStream object. That means that a standard output stream can be redirected to it by System.setOut(PrintStream ps). To get the output to the screen, make this SystemOutStream familiar with your jpiv2.CmdFrame by using the method assignCmdFrame(jpiv2.CmdFrame cmdFrame). The write methods in jpiv2.SystemOutStream (overridden in super-class) write the standard output to the assigned CmdFrame by using jpiv2.CmdFrame.append(String str).


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
SystemOutStream(java.io.PrintStream ps)
          Creates a new instance of SystemOutStream.
 
Method Summary
 void assignCmdFrame(CmdFrame cmdFrame)
          Defines the destination for the system output.
 void write(byte[] buf, int off, int len)
          Overrides write(byte buf[], int off, int len) in PrintStream.
 void write(int b)
          Overrides write(int b) in PrintStream.
 
Methods inherited from class java.io.PrintStream
append, append, append, checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemOutStream

public SystemOutStream(java.io.PrintStream ps)
Creates a new instance of SystemOutStream.

Parameters:
ps - A PrintStream object like System.out.
Method Detail

assignCmdFrame

public void assignCmdFrame(CmdFrame cmdFrame)
Defines the destination for the system output.

Parameters:
cmdFrame - The jpiv2.CmdFrame that serves as a destination for system output.

write

public void write(int b)
Overrides write(int b) in PrintStream. The data is written to the assigned jpiv2.CmdFrame.

Overrides:
write in class java.io.PrintStream
Parameters:
b - A value to be written.

write

public void write(byte[] buf,
                  int off,
                  int len)
Overrides write(byte buf[], int off, int len) in PrintStream. The data is written to the assigned jpiv2.CmdFrame.

Overrides:
write in class java.io.PrintStream
Parameters:
buf - A byte buffer to be written.
off - Index of first written buffer element.
len - Number of written buffer elements.