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 // You should prefer nsIAsyncStreamCopier2
13 [scriptable
, uuid(5a19ca27
-e041
-4aca
-8287-eb248d4c50c0
)]
14 interface nsIAsyncStreamCopier
: nsIRequest
17 * Initialize the stream copier.
20 * contains the data to be copied.
22 * specifies the destination for the data.
24 * specifies the thread on which the copy will occur. a null value
25 * is permitted and will cause the copy to occur on an unspecified
27 * @param aSourceBuffered
28 * true if aSource implements ReadSegments.
29 * @param aSinkBuffered
30 * true if aSink implements WriteSegments.
32 * specifies how many bytes to read/write at a time. this controls
33 * the granularity of the copying. it should match the segment size
34 * of the "buffered" streams involved.
36 * true if aSource should be closed after copying.
38 * true if aSink should be closed after copying.
40 * NOTE: at least one of the streams must be buffered. If you do not know
41 * whether your streams are buffered, you should use nsIAsyncStreamCopier2
44 void init
(in nsIInputStream aSource
,
45 in nsIOutputStream aSink
,
46 in nsIEventTarget aTarget
,
47 in boolean aSourceBuffered
,
48 in boolean aSinkBuffered
,
49 in unsigned long aChunkSize
,
50 in boolean aCloseSource
,
51 in boolean aCloseSink
);
54 * asyncCopy triggers the start of the copy. The observer will be notified
55 * when the copy completes.
58 * receives notifications.
59 * @param aObserverContext
60 * passed to observer methods.
62 void asyncCopy
(in nsIRequestObserver aObserver
,
63 in nsISupports aObserverContext
);