org.tranche.streams
Class StringPrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by org.tranche.streams.StringPrintStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class StringPrintStream
extends java.io.PrintStream

Returns contents of everything writen to print stream as string.

Author:
Bryan Smith - bryanesmith@gmail.com

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Method Summary
static StringPrintStream create()
          Creates a enw StringPrintStream object.
 java.lang.String getOutput()
           
 
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, 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
 

Method Detail

create

public static StringPrintStream create()

Creates a enw StringPrintStream object.

A StringPrintStream can be used as a PrintStream. All it does is store all written data as a string, which can be later retrieved using getOutput().

This is especially useful when want to log an activity.

Returns:

getOutput

public java.lang.String getOutput()


This code is free for use both commercially and non-commercially as stated in the project's license