nsIConverterInputStream

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