textbender.g.io
Class StringOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by StringOutputStream
All Implemented Interfaces:
Closeable, Flushable

public final class StringOutputStream
extends OutputStream

An output stream that writes to a string builder.


Constructor Summary
StringOutputStream(StringBuilder stringBuilder, String encodingName)
          Creates a StringOutputStream.
 
Method Summary
 void close()
          Does nothing.
 String encodingName()
          Character encoding of this stream's bytes.
 void flush()
           
 void reset()
          Resets this stream, discarding any output in the string builder.
 StringBuilder stringBuilder()
          Underlying string builder, into which output strings are written.
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringOutputStream

public StringOutputStream(StringBuilder stringBuilder,
                          String encodingName)
Creates a StringOutputStream.

Parameters:
stringBuilder - per stringBuilder
encodingName - per encodingName
Method Detail

encodingName

public String encodingName()
Character encoding of this stream's bytes.


reset

public void reset()
Resets this stream, discarding any output in the string builder.


stringBuilder

public StringBuilder stringBuilder()
Underlying string builder, into which output strings are written.


close

public void close()
Does nothing.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream

flush

public void flush()
           throws CharacterCodingException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
CharacterCodingException

write

public void write(int b)
           throws CharacterCodingException
Specified by:
write in class OutputStream
Throws:
CharacterCodingException