edu.vt.middleware.crypt.io
Class TeePrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by edu.vt.middleware.crypt.io.TeePrintStream
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class TeePrintStream
extends PrintStream

Works like the Unix tee utility by writing to two streams simultaneously, where one is typically STDOUT or STDERR.

Version:
$Revision: 2745 $
Author:
Middleware Services

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
TeePrintStream(OutputStream out1, OutputStream out2)
          Creates a tee stream that writes to both of the given streams simultaneously.
 
Method Summary
 void flush()
          
 void write(byte[] buf, int off, int len)
          
 void write(int b)
          
 
Methods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, 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

TeePrintStream

public TeePrintStream(OutputStream out1,
                      OutputStream out2)
Creates a tee stream that writes to both of the given streams simultaneously. To operate like the Unix tee, the second stream should be STDOUT or STDERR.

Parameters:
out1 - Primary output stream.
out2 - Secondary output stream, usually System.out or System.err.
Method Detail

write

public void write(int b)

Overrides:
write in class PrintStream

write

public void write(byte[] buf,
                  int off,
                  int len)

Overrides:
write in class PrintStream

flush

public void flush()

Specified by:
flush in interface Flushable
Overrides:
flush in class PrintStream


Copyright © 2003-2013 Virginia Tech. All Rights Reserved.