com.sas.io
Class EchoingPrintWriter

com.sas.io.EchoingPrintWriter
All Implemented Interfaces:
com.sas.PublicClonable, java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable, java.lang.Cloneable

public class EchoingPrintWriter
implements com.sas.PublicClonable

EchoingPrintWriter echoes print output to a secondary PrintWriter. All strings printed to this stream are also printed to the secondary stream.


Constructor Summary
EchoingPrintWriter(java.io.OutputStream primary)
          Construct an EchoingPrintWriter which prints to both a primary OutputStream and to Standard.out
EchoingPrintWriter(java.io.OutputStream primary, java.io.PrintWriter secondary)
          Construct an EchoingPrintWriter which prints to both a primary OutputStream and to a secondary PrintWriter.
 
Method Summary
 java.lang.Object clone()
          Create a copy of the current EchoingPrintWriter
 void close()
          Close the print streams.
 void close(boolean closeSecondary)
          Close the print streams.
 void print(java.lang.String s)
          Print a string to both output streams.
 void println(java.lang.String s)
          Print a string and a newline to both output streams.
 

Constructor Detail

EchoingPrintWriter

public EchoingPrintWriter(java.io.OutputStream primary)
Construct an EchoingPrintWriter which prints to both a primary OutputStream and to Standard.out

Parameters:
primary - an output stream to print to.

EchoingPrintWriter

public EchoingPrintWriter(java.io.OutputStream primary,
                          java.io.PrintWriter secondary)
Construct an EchoingPrintWriter which prints to both a primary OutputStream and to a secondary PrintWriter.

Parameters:
primary - an output stream to print to.
secondary - a secondary PrintWriter to which output is also printed.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create a copy of the current EchoingPrintWriter

Specified by:
clone in interface com.sas.PublicClonable
Overrides:
clone in class java.lang.Object
Returns:
a clone of this EchoingPrintWriter
Throws:
java.lang.CloneNotSupportedException - if the object cannot be cloned.

print

public void print(java.lang.String s)
Print a string to both output streams.

Overrides:
print in class java.io.PrintWriter
Parameters:
s - a string value.

println

public void println(java.lang.String s)
Print a string and a newline to both output streams.

Overrides:
println in class java.io.PrintWriter
Parameters:
s - a string value.

close

public void close()
Close the print streams.

Specified by:
close in interface java.io.Closeable
Specified by:
close in interface java.lang.AutoCloseable
Overrides:
close in class java.io.PrintWriter

close

public void close(boolean closeSecondary)
Close the print streams.

Parameters:
closeSecondary - if true, also close the secondary stream. if false, only close this stream.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.