|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/io/OutputStreamWriter.h"
A CodeConverter can be configured to behave in one of two specified ways when it encounters a Unicode character that cannot be mapped into the target encoding. By default, unmappable characters are silently dealt with by replacing the character with a default replacement character. A stricter scheme is also available that treats unmappable characters as non-recoverable errors and throws an UnmappableCharacterException. Overloaded versions of the OutputStreamWriter constructors can be used to explicitly set the required policy.
To improve efficiency, the OutputStreamWriter contains a byte buffer into which it encodes Unicode characters. It is only when the buffer fills or one of the flush() methods are called that the bytes are actually written to the underlying byte stream.
See the description of InputStreamReader for a sample piece of code that uses an OutputStreamWriter.
Constructor/Destructor Summary | |
OutputStreamWriter(OutputStream* pOutputStream) Constructs an OutputStreamWriter with pOutputStream as the contained OutputStream. | |
OutputStreamWriter(OutputStream* pOut, const String& encoding) Constructs an OutputStreamWriter with pOutputStream as the contained OutputStream and encoding as the specified encoding name. | |
OutputStreamWriter(OutputStream* pOut, CodeConverter* pEncoder) Constructs an OutputStreamWriter with pOutputStream as the contained OutputStream and @pEncoder as the CodeConverter which will encode Unicode characters into bytes for the underlying output stream. | |
OutputStreamWriter(OutputStream* pOut, const String& encoding, bool bStrict) Constructs an OutputStreamWriter with pOutputStream as the contained OutputStream and encoding as the specified encoding name. | |
~OutputStreamWriter() The destructor flushes the byte buffer to the underlying OutputStream before freeing resources associated with this OutputStreamWriter. |
Method Summary | |
virtual void |
close() Closes the character stream, flushing it first. |
virtual void |
flush() Flushes any output buffers before forcing the output to its final destination. |
virtual void |
flushBuffers() If this Writer maintains an output buffer, the buffer is emptied and written to the output destination without requesting the final destination to flush the output. |
RefPtr< CodeConverter > |
getEncoder() const Returns a reference to the CodeConverter employed by this OutputStreamWriter. |
String |
getEncoding() const Returns the canonical name of the encoding employed by the underlying byte stream. |
virtual void |
write(const CharType* pBuf, size_t len) Writes an array of CharType characters. |
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 |
getLock, write, write, write |
Constructor/Destructor Detail |
OutputStreamWriter(OutputStream* pOutputStream)
pOutputStream
- NullPointerException
- OutputStreamWriter(OutputStream* pOut, const String& encoding)
pOutputStream
- encoding
- NullPointerException
- UnsupportedEncodingException
- OutputStreamWriter(OutputStream* pOut, CodeConverter* pEncoder)
pOutputStream
- pEncoder
- NullPointerException
- OutputStreamWriter(OutputStream* pOut, const String& encoding, bool bStrict)
pOutputStream
- encoding
- bStrict
- NullPointerException
- UnsupportedEncodingException
- virtual ~OutputStreamWriter()
Method Detail |
virtual void close()
virtual void flush()
IOException
- virtual void flushBuffers()
RefPtr< CodeConverter > getEncoder() const
String getEncoding() const
virtual void write(const CharType* pBuf, size_t len)
pStr
- len
- IOException
-
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |