nsIConverterInputStream 编辑

xpcom/io/nsIConverterInputStream.idlScriptable A unichar input stream that wraps an input stream. This allows reading unicode strings from a stream, automatically converting the bytes from a selected character encoding. 1.0 66 Introduced Gecko 1.8 Inherits from: nsIUnicharInputStream Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

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

var converterInputStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
                           .createInstance(Components.interfaces.nsIConverterInputStream);

Method overview

void init(in nsIInputStream aStream, in string aCharset, in long aBufferSize, in PRUnichar aReplacementChar);

Constants

ConstantValueDescription
DEFAULT_REPLACEMENT_CHARACTER0xFFFDDefault replacement character value.

Methods

init()

Initialize this stream.

void init(
  in nsIInputStream aStream,
  in string aCharset,
  in long aBufferSize,
  in PRUnichar aReplacementChar
);
Parameters
aStream
The source stream which is read and converted.
aCharset
The character encoding to use for converting the bytes of the stream. A value of null or "UTF-8" equals UTF-8 encoding. Latin 1 is specified as "ISO-8859-1".
aBufferSize
Defines the buffer size of the converter stream. In case of a buffer size of less than or equal to 0, the default size CONVERTER_BUFFER_SIZE will be used. This is currently set to 8192 bytes.
aReplacementChar
Any unknown byte sequence will be replaced with this character. The default replacement character is U+FFFD. A value of 0x0000 will cause an exception to be thrown if unknown byte sequences are encountered in the stream.

See also

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

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

发布评论

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

词条统计

浏览:69 次

字数:3370

最后编辑:6 年前

编辑次数:0 次

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