org.freehep.util.io
Class UniquePrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by org.freehep.util.io.UniquePrintStream
All Implemented Interfaces:
Closeable, Flushable, Appendable, FinishableOutputStream

public class UniquePrintStream
extends PrintStream
implements FinishableOutputStream

The UniquePrintStream keeps Strings buffered in sorted order, but any duplicates are removed. This stream can be used to print error messages exactly once. When finish is called all messages are printed. It only acts on the println(String) method, any other method will print directly.

Version:
$Id: UniquePrintStream.java 8584 2006-08-10 23:06:37Z duns $
Author:
Mark Donszelmann

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
UniquePrintStream(OutputStream out)
          Create a Unique Print Stream.
 
Method Summary
 void finish()
          Finishes the current outputstream (compresses, flushes, caluclates CRC) and writes whatever is left in the buffers, but does not close the stream.
 void println(String s)
           
 
Methods inherited from class java.io.PrintStream
append, append, append, 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, setError, write, write
 
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

UniquePrintStream

public UniquePrintStream(OutputStream out)
Create a Unique Print Stream.

Parameters:
out - stream to write
Method Detail

println

public void println(String s)
Overrides:
println in class PrintStream

finish

public void finish()
Description copied from interface: FinishableOutputStream
Finishes the current outputstream (compresses, flushes, caluclates CRC) and writes whatever is left in the buffers, but does not close the stream.

Specified by:
finish in interface FinishableOutputStream


Copyright © 2000-2007 FreeHEP. All Rights Reserved.