fr.gedeon.telnetservice.util
Class StringBufferPrintStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.PrintStream
              extended by fr.gedeon.telnetservice.util.AbstractPrintStream
                  extended by fr.gedeon.telnetservice.util.StringBufferPrintStream
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class StringBufferPrintStream
extends AbstractPrintStream

This provides a PrintStream implementation that outputs the stream to an internal StringBuffer that is available through getBuffer().
Note: Instances of this class do not to be closed, and can be reused by clearing the buffer between uses: getBuffer().setLength(0).


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
StringBufferPrintStream()
           
 
Method Summary
 StringBuffer getBuffer()
          Get the internal storage StringBuffer.
 void write(byte[] buf, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class fr.gedeon.telnetservice.util.AbstractPrintStream
_write, _write
 
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
 
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

StringBufferPrintStream

public StringBufferPrintStream()
Method Detail

write

public void write(int b)
Specified by:
write in class AbstractPrintStream

write

public void write(byte[] buf,
                  int off,
                  int len)
Specified by:
write in class AbstractPrintStream

getBuffer

public StringBuffer getBuffer()
Get the internal storage StringBuffer. Note: changes to the returned object will change the internal buffer (it's not a copy).



Copyright © 2008. All Rights Reserved.