public class SystemOutStream
extends java.io.PrintStream
// 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);
Constructor and Description |
---|
SystemOutStream(java.io.PrintStream ps)
Creates a new instance of
SystemOutStream . |
Modifier and Type | Method and Description |
---|---|
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. |
public SystemOutStream(java.io.PrintStream ps)
SystemOutStream
.ps
- A PrintStream object like System.out
.public void assignCmdFrame(CmdFrame cmdFrame)
cmdFrame
- The jpiv2.CmdFrame that serves as a destination for system
output.public void write(int b)
write(int b)
in PrintStream. The data is written
to the assigned jpiv2.CmdFrame.write
in class java.io.PrintStream
b
- A value to be written.public void write(byte[] buf, int off, int len)
write(byte buf[], int off, int len)
in
PrintStream. The data is written to the assigned jpiv2.CmdFrame.write
in class java.io.PrintStream
buf
- A byte buffer to be written.off
- Index of first written buffer element.len
- Number of written buffer elements.