1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
7 interface nsITransport
;
8 interface nsIInputStream
;
9 interface nsIOutputStream
;
10 interface nsIInputAvailableCallback
;
13 * This service read/writes a stream on a background thread.
15 * Note: instead of using this interface, probably you want to use
16 * NS_MakeAsyncNonBlockingInputStream.
18 * Use this service to transform any blocking stream (e.g., file stream)
19 * into a fully asynchronous stream that can be read/written without
20 * blocking the main thread.
22 [builtinclass
, scriptable
, uuid(5e0adf7d
-9785-45c3
-a193
-04f25a75da8f
)]
23 interface nsIStreamTransportService
: nsISupports
26 * CreateInputTransport
29 * The input stream that will be read on a background thread.
30 * This stream must implement "blocking" stream semantics.
31 * @param aCloseWhenDone
32 * Specify this flag to have the input stream closed once its
33 * contents have been completely read.
35 * @return nsITransport instance.
37 nsITransport createInputTransport
(in nsIInputStream aStream
,
38 in boolean aCloseWhenDone
);
40 void InputAvailable
(in nsIInputStream aStream
,
41 in nsIInputAvailableCallback aCallback
);
44 [uuid(ff2da731
-44d0
-4dd9
-8236-c99387fec721
)]
45 interface nsIInputAvailableCallback
: nsISupports
47 void onInputAvailableComplete
(in unsigned long long available
,
48 in nsresult available_return_code
);