summaryrefslogtreecommitdiffstats
path: root/netwerk/base/nsIStreamTransportService.idl
blob: 3df8d4c127a38d1b19305910fd86d9c00af033b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsITransport;
interface nsIInputStream;
interface nsIOutputStream;
interface nsIInputAvailableCallback;

/**
 * This service read/writes a stream on a background thread.
 *
 * Note: instead of using this interface, probably you want to use
 * NS_MakeAsyncNonBlockingInputStream.
 *
 * Use this service to transform any blocking stream (e.g., file stream)
 * into a fully asynchronous stream that can be read/written without
 * blocking the main thread.
 */
[builtinclass, scriptable, uuid(5e0adf7d-9785-45c3-a193-04f25a75da8f)]
interface nsIStreamTransportService : nsISupports
{
    /**
     * CreateInputTransport
     *
     * @param aStream
     *        The input stream that will be read on a background thread.
     *        This stream must implement "blocking" stream semantics.
     * @param aCloseWhenDone
     *        Specify this flag to have the input stream closed once its
     *        contents have been completely read.
     *
     * @return nsITransport instance.
     */
    nsITransport createInputTransport(in nsIInputStream aStream,
                                      in boolean aCloseWhenDone);
};