Cross-Platform C++

ot::io
class StringWriter

#include "ot/io/StringWriter.h"

ot::io::Writer ot::SynchronizedObject ot::ManagedObject A Writer which collects output characters in a buffer, which can then be used to create a String.

See also:
StringReader



Constructor/Destructor Summary
StringWriter()
         Constructs a StringWriter with no initial size.
StringWriter(size_t initialSize)
         Constructs a StringWriter with an initial size of initialSize.

Method Summary
 virtual void close()
         Closes the StringWriter.
 String toString() const
         Creates a string from the internal character buffer.
 virtual void write(const CharType* pBuf, size_t len)
         Writes the character buffer pBuf with a length of len.

Methods inherited from class ot::ManagedObject
addRef, getRefCount, onFinalRelease, operator=, release

Methods inherited from class ot::SynchronizedObject
lock, unlock

Methods inherited from class ot::io::Writer
flush, flushBuffers, getLock, write, write, write

Constructor/Destructor Detail

StringWriter

 StringWriter()
Constructs a StringWriter with no initial size.


StringWriter

 StringWriter(size_t initialSize)
Constructs a StringWriter with an initial size of initialSize.


Method Detail

close

virtual void close()
Closes the StringWriter. The internal string buffer is not released so that it remains available for subsequent calls to toString().

Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

toString

String toString() const
Creates a string from the internal character buffer.

Returns:
A String containing all the characters that have been written to the StringWriter so far.
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.

write

virtual void write(const CharType* pBuf,
                   size_t len)
Writes the character buffer pBuf with a length of len.

Exceptions:
IOException - if the StringWriter has been closed
Multi-threaded considerations:
Synchronized for safe access from multiple concurrent threads.


Cross-Platform C++

Found a bug or missing feature? Please email us at support@elcel.com

Copyright © 2000-2003 ElCel Technology   Trademark Acknowledgements