com.caucho.vfs
Class StringWriter

java.lang.Object
  |
  +--com.caucho.vfs.StreamImpl
        |
        +--com.caucho.vfs.StringWriter

public class StringWriter
extends StreamImpl


Fields inherited from class com.caucho.vfs.StreamImpl
nullPath, path
 
Constructor Summary
StringWriter()
           
StringWriter(CharBuffer cb)
           
 
Method Summary
 boolean canWrite()
          Returns true since StringWriter is for writing.
 java.lang.String getString()
           
 WriteStream openWrite()
          Opens a write stream using this StringWriter as the resulting string
 void write(byte[] buf, int offset, int length, boolean isEnd)
          Writes a utf-8 encoded buffer to the underlying string.
 
Methods inherited from class com.caucho.vfs.StreamImpl
canRead, clearWrite, close, flush, getAttribute, getAttributeNames, getAvailable, getFlushOnNewline, getNewline, getPath, getReadPosition, hasSkip, read, removeAttribute, setAttribute, setPath, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringWriter

public StringWriter()

StringWriter

public StringWriter(CharBuffer cb)
Method Detail

openWrite

public WriteStream openWrite()
Opens a write stream using this StringWriter as the resulting string

getString

public java.lang.String getString()

canWrite

public boolean canWrite()
Returns true since StringWriter is for writing.
Overrides:
canWrite in class StreamImpl

write

public void write(byte[] buf,
                  int offset,
                  int length,
                  boolean isEnd)
           throws java.io.IOException
Writes a utf-8 encoded buffer to the underlying string.
Overrides:
write in class StreamImpl
Parameters:
buf - byte buffer containing the bytes
offset - offset where to start writing
length - number of bytes to write
isEnd - true when the write is flushing a close.