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
;
12 * This service read/writes a stream on a background thread.
14 * Use this service to transform any blocking stream (e.g., file stream)
15 * into a fully asynchronous stream that can be read/written without
16 * blocking the main thread.
18 [scriptable
, uuid(5e0adf7d
-9785-45c3
-a193
-04f25a75da8f
)]
19 interface nsIStreamTransportService
: nsISupports
22 * CreateInputTransport
25 * The input stream that will be read on a background thread.
26 * This stream must implement "blocking" stream semantics.
28 * The input stream will be read starting from this offset. Pass
29 * -1 to read from the current stream offset. NOTE: this parameter
30 * is ignored if the stream does not support nsISeekableStream.
32 * This parameter limits the number of bytes that will be read from
33 * the input stream. Pass -1 to read everything.
34 * @param aCloseWhenDone
35 * Specify this flag to have the input stream closed once its
36 * contents have been completely read.
38 * @return nsITransport instance.
40 nsITransport createInputTransport
(in nsIInputStream aStream
,
41 in long long aStartOffset
,
42 in long long aReadLimit
,
43 in boolean aCloseWhenDone
);
46 * CreateOutputTransport
49 * The output stream that will be written to on a background thread.
50 * This stream must implement "blocking" stream semantics.
52 * The output stream will be written starting at this offset. Pass
53 * -1 to write to the current stream offset. NOTE: this parameter
54 * is ignored if the stream does not support nsISeekableStream.
56 * This parameter limits the number of bytes that will be written to
57 * the output stream. Pass -1 for unlimited writing.
58 * @param aCloseWhenDone
59 * Specify this flag to have the output stream closed once its
60 * contents have been completely written.
62 * @return nsITransport instance.
64 nsITransport createOutputTransport
(in nsIOutputStream aStream
,
65 in long long aStartOffset
,
66 in long long aWriteLimit
,
67 in boolean aCloseWhenDone
);