ot::io
class StringWriter
#include "ot/io/StringWriter.h"
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. |
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.
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.
Found a bug or missing feature? Please email us at support@elcel.com