Bug 452317 - FeedConverter.js: QueryInterface should throw NS_ERROR_NO_INTERFACE...
[wine-gecko.git] / xpcom / io / nsIStringStream.idl
blobc2354bf96039241a5a743fc5ded9e70aeb18c6d4
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * mcmullen@netscape.com (original author)
24 * scc@mozilla.org
25 * davidm@netscape.com
26 * darin@meer.net
28 * Alternatively, the contents of this file may be used under the terms of
29 * either of the GNU General Public License Version 2 or later (the "GPL"),
30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
42 #include "nsIInputStream.idl"
44 /**
45 * nsIStringInputStream
47 * Provides scriptable and specialized C++-only methods for initializing a
48 * nsIInputStream implementation with a simple character array.
50 * @status UNDER_REVIEW
52 [scriptable, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)]
53 interface nsIStringInputStream : nsIInputStream
55 /**
56 * SetData - assign data to the input stream (copied on assignment).
58 * @param data - stream data
59 * @param dataLen - stream data length (-1 if length should be computed)
61 * NOTE: C++ code should consider using AdoptData or ShareData to avoid
62 * making an extra copy of the stream data.
64 * NOTE: For JS callers, the given data must not contain null characters
65 * (other than a null terminator) because a null character in the middle of
66 * the data string will be seen as a terminator when the data is converted
67 * from a JS string to a C++ character array.
69 void setData(in string data, in long dataLen);
71 /**
72 * NOTE: the following methods are designed to give C++ code added control
73 * over the ownership and lifetime of the stream data. Use with care :-)
76 /**
77 * AdoptData - assign data to the input stream. the input stream takes
78 * ownership of the given data buffer and will nsMemory::Free it when
79 * the input stream is destroyed.
81 * @param data - stream data
82 * @param dataLen - stream data length (-1 if length should be computed)
84 [noscript] void adoptData(in charPtr data, in long dataLen);
86 /**
87 * ShareData - assign data to the input stream. the input stream references
88 * the given data buffer until the input stream is destroyed. the given
89 * data buffer must outlive the input stream.
91 * @param data - stream data
92 * @param dataLen - stream data length (-1 if length should be computed)
94 [noscript] void shareData(in string data, in long dataLen);