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
"nsIRequest.idl"
7 interface nsIInputStream
;
8 interface nsIOutputStream
;
9 interface nsIRequestObserver
;
10 interface nsIEventTarget
;
12 [scriptable
, uuid(a5b2decf
-4ede
-4801-8b38
-e5fe5db46bf2
)]
13 interface nsIAsyncStreamCopier2
: nsIRequest
16 * Initialize the stream copier.
18 * If neither the source nor the sink are buffered, buffering will
19 * be automatically added to the sink.
23 * contains the data to be copied.
25 * specifies the destination for the data.
27 * specifies the thread on which the copy will occur. a null value
28 * is permitted and will cause the copy to occur on an unspecified
31 * specifies how many bytes to read/write at a time. this controls
32 * the granularity of the copying. it should match the segment size
33 * of the "buffered" streams involved.
35 * true if aSource should be closed after copying (this is generally
36 * the desired behavior).
38 * true if aSink should be closed after copying (this is generally
39 * the desired behavior).
41 void init
(in nsIInputStream aSource
,
42 in nsIOutputStream aSink
,
43 in nsIEventTarget aTarget
,
44 in unsigned long aChunkSize
,
45 in boolean aCloseSource
,
46 in boolean aCloseSink
);
49 * asyncCopy triggers the start of the copy. The observer will be notified
50 * when the copy completes.
53 * receives notifications.
54 * @param aObserverContext
55 * passed to observer methods.
57 void asyncCopy
(in nsIRequestObserver aObserver
,
58 in nsISupports aObserverContext
);