xpcom/io/nsIConverterInputStream.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/io/nsIConverterInputStream.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsIUnicharInputStream.idl"
    1.10 +
    1.11 +interface nsIInputStream;
    1.12 +
    1.13 +/**
    1.14 + * A unichar input stream that wraps an input stream.
    1.15 + * This allows reading unicode strings from a stream, automatically converting
    1.16 + * the bytes from a selected character encoding.
    1.17 + */
    1.18 +[scriptable, uuid(FC66FFB6-5404-4908-A4A3-27F92FA0579D)]
    1.19 +interface nsIConverterInputStream : nsIUnicharInputStream {
    1.20 +    /**
    1.21 +     * Default replacement char value, U+FFFD REPLACEMENT CHARACTER.
    1.22 +     */
    1.23 +    const char16_t DEFAULT_REPLACEMENT_CHARACTER = 0xFFFD;
    1.24 +
    1.25 +    /**
    1.26 +     * Initialize this stream.
    1.27 +     * @param aStream 
    1.28 +     *        The underlying stream to read from.
    1.29 +     * @param aCharset
    1.30 +     *        The character encoding to use for converting the bytes of the
    1.31 +     *        stream. A null charset will be interpreted as UTF-8.
    1.32 +     * @param aBufferSize
    1.33 +     *        How many bytes to buffer.
    1.34 +     * @param aReplacementChar
    1.35 +     *        The character to replace unknown byte sequences in the stream
    1.36 +     *        with. The standard replacement character is U+FFFD.
    1.37 +     *        A value of 0x0000 will cause an exception to be thrown if unknown
    1.38 +     *        byte sequences are encountered in the stream.
    1.39 +     */
    1.40 +    void init (in nsIInputStream aStream, in string aCharset,
    1.41 +               in long aBufferSize, in char16_t aReplacementChar);
    1.42 +};
    1.43 +

mercurial