michael@0: /* vim:set expandtab ts=4 sw=4 sts=4 cin: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIUnicharOutputStream.idl" michael@0: michael@0: interface nsIOutputStream; michael@0: michael@0: /** michael@0: * This interface allows writing strings to a stream, doing automatic michael@0: * character encoding conversion. michael@0: */ michael@0: [scriptable, uuid(4b71113a-cb0d-479f-8ed5-01daeba2e8d4)] michael@0: interface nsIConverterOutputStream : nsIUnicharOutputStream michael@0: { michael@0: /** michael@0: * Initialize this stream. Must be called before any other method on this michael@0: * interface, or you will crash. The output stream passed to this method michael@0: * must not be null, or you will crash. michael@0: * michael@0: * @param aOutStream michael@0: * The underlying output stream to which the converted strings will michael@0: * be written. michael@0: * @param aCharset michael@0: * The character set to use for encoding the characters. A null michael@0: * charset will be interpreted as UTF-8. michael@0: * @param aBufferSize michael@0: * How many bytes to buffer. A value of 0 means that no bytes will be michael@0: * buffered. Implementations not supporting buffering may ignore michael@0: * this parameter. michael@0: * @param aReplacementCharacter michael@0: * The replacement character to use when an unsupported character is found. michael@0: * The character must be encodable in the selected character michael@0: * encoding; otherwise, attempts to write an unsupported character michael@0: * will throw NS_ERROR_LOSS_OF_SIGNIFICANT_DATA. michael@0: * michael@0: * A value of 0x0000 will cause an exception to be thrown upon michael@0: * attempts to write unsupported characters. michael@0: */ michael@0: void init(in nsIOutputStream aOutStream, in string aCharset, michael@0: in unsigned long aBufferSize, michael@0: in char16_t aReplacementCharacter); michael@0: };