Bumping manifests a=b2g-bump
[gecko.git] / xpcom / io / nsIStringStream.idl
blobfec418a4f42477407b5799dd3a4d7dba74ae522d
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 "nsIInputStream.idl"
8 /**
9 * nsIStringInputStream
11 * Provides scriptable and specialized C++-only methods for initializing a
12 * nsIInputStream implementation with a simple character array.
14 [scriptable, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)]
15 interface nsIStringInputStream : nsIInputStream
17 /**
18 * SetData - assign data to the input stream (copied on assignment).
20 * @param data - stream data
21 * @param dataLen - stream data length (-1 if length should be computed)
23 * NOTE: C++ code should consider using AdoptData or ShareData to avoid
24 * making an extra copy of the stream data.
26 * NOTE: For JS callers, the given data must not contain null characters
27 * (other than a null terminator) because a null character in the middle of
28 * the data string will be seen as a terminator when the data is converted
29 * from a JS string to a C++ character array.
31 void setData(in string data, in long dataLen);
33 /**
34 * NOTE: the following methods are designed to give C++ code added control
35 * over the ownership and lifetime of the stream data. Use with care :-)
38 /**
39 * AdoptData - assign data to the input stream. the input stream takes
40 * ownership of the given data buffer and will nsMemory::Free it when
41 * the input stream is destroyed.
43 * @param data - stream data
44 * @param dataLen - stream data length (-1 if length should be computed)
46 [noscript] void adoptData(in charPtr data, in long dataLen);
48 /**
49 * ShareData - assign data to the input stream. the input stream references
50 * the given data buffer until the input stream is destroyed. the given
51 * data buffer must outlive the input stream.
53 * @param data - stream data
54 * @param dataLen - stream data length (-1 if length should be computed)
56 [noscript] void shareData(in string data, in long dataLen);