michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 "nsIInputStream.idl" michael@0: michael@0: /** michael@0: * The MIME stream separates headers and a datastream. It also allows michael@0: * automatic creation of the content-length header. michael@0: */ michael@0: michael@0: [scriptable, uuid(dcbce63c-1dd1-11b2-b94d-91f6d49a3161)] michael@0: interface nsIMIMEInputStream : nsIInputStream michael@0: { michael@0: /** michael@0: * When true a "Content-Length" header is automatically added to the michael@0: * stream. The value of the content-length is automatically calculated michael@0: * using the available() method on the data stream. The value is michael@0: * recalculated every time the stream is rewinded to the start. michael@0: * Not allowed to be changed once the stream has been started to be read. michael@0: */ michael@0: attribute boolean addContentLength; michael@0: michael@0: /** michael@0: * Adds an additional header to the stream on the form "name: value". May michael@0: * not be called once the stream has been started to be read. michael@0: * @param name name of the header michael@0: * @param value value of the header michael@0: */ michael@0: void addHeader(in string name, in string value); michael@0: michael@0: /** michael@0: * Sets data-stream. May not be called once the stream has been started michael@0: * to be read. michael@0: * The cursor of the new stream should be located at the beginning of the michael@0: * stream if the implementation of the nsIMIMEInputStream also is used as michael@0: * an nsISeekableStream. michael@0: * @param stream stream containing the data for the stream michael@0: */ michael@0: void setData(in nsIInputStream stream); michael@0: };