nsIConverterInputStream 编辑
xpcom/io/nsIConverterInputStream.idl
Scriptable 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
Constant | Value | Description |
DEFAULT_REPLACEMENT_CHARACTER | 0xFFFD | Default 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
nsIConverterOutputStream
- See Reading textual data for an example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论