1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsIUnicharInputStream.idl"
8 interface nsIInputStream
;
11 * A unichar input stream that wraps an input stream.
12 * This allows reading unicode strings from a stream, automatically converting
13 * the bytes from a selected character encoding.
15 [scriptable
, builtinclass
, uuid(FC66FFB6
-5404-4908-A4A3
-27F92FA0579D
)]
16 interface nsIConverterInputStream
: nsIUnicharInputStream
{
18 * Default replacement char value, U+FFFD REPLACEMENT CHARACTER.
20 const char16_t DEFAULT_REPLACEMENT_CHARACTER
= 0xFFFD;
23 * Special replacement character value that requests errors to
24 * be treated as fatal.
26 const char16_t ERRORS_ARE_FATAL
= 0;
29 * Initialize this stream.
31 * The underlying stream to read from.
33 * The character encoding to use for converting the bytes of the
34 * stream. A null charset will be interpreted as UTF-8.
36 * How many bytes to buffer.
37 * @param aReplacementChar
38 * The character to replace unknown byte sequences in the stream
39 * with. The standard replacement character is U+FFFD.
40 * A value of 0x0000 will cause an exception to be thrown if unknown
41 * byte sequences are encountered in the stream.
43 void init
(in nsIInputStream aStream
, in string aCharset
,
44 in long aBufferSize
, in char16_t aReplacementChar
);