nsIConverterOutputStream 编辑

xpcom/io/nsIConverterOutputStream.idlScriptable This interface allows writing strings to a stream, doing automatic character encoding conversion. 1.0 66 Introduced Gecko 1.8 Inherits from: nsIUnicharOutputStream Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Implemented by: @mozilla.org/intl/converter-output-stream;1. To create an instance, use:

var converterOutputStream = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
                            .createInstance(Components.interfaces.nsIConverterOutputStream);

Method overview

void init(in nsIOutputStream aOutStream, in string aCharset, in unsigned long aBufferSize, in PRUnichar aReplacementCharacter);

Methods

init()

Initialize this stream. Must be called before any other method on this interface, or you will crash. The output stream passed to this method must not be null, or you will crash.

void init(
  in nsIOutputStream aOutStream,
  in string aCharset,
  in unsigned long aBufferSize,
  in PRUnichar aReplacementCharacter
);
Parameters
aOutStream
The underlying output stream to which the converted strings will be written.
aCharset
The character set to use for encoding the characters. A null charset will be interpreted as UTF-8.
aBufferSize
How many bytes to buffer. A value of 0 means that no bytes will be buffered. Implementations not supporting buffering may ignore this parameter.
aReplacementCharacter
The replacement character to use when an unsupported character is found. A value of 0x0000 will cause an exception to be thrown upon attempts to write unsupported characters.
Exceptions thrown
NS_ERROR_LOSS_OF_SIGNIFICANT_DATA
If aReplacementCharacter is not encodable in the selected character encoding and an attempt is made to write the character.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:103 次

字数:3253

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文