1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/public/nsIAsyncStreamCopier.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsIRequest.idl" 1.9 + 1.10 +interface nsIInputStream; 1.11 +interface nsIOutputStream; 1.12 +interface nsIRequestObserver; 1.13 +interface nsIEventTarget; 1.14 + 1.15 +// You should prefer nsIAsyncStreamCopier2 1.16 +[scriptable, uuid(5a19ca27-e041-4aca-8287-eb248d4c50c0)] 1.17 +interface nsIAsyncStreamCopier : nsIRequest 1.18 +{ 1.19 + /** 1.20 + * Initialize the stream copier. 1.21 + * 1.22 + * @param aSource 1.23 + * contains the data to be copied. 1.24 + * @param aSink 1.25 + * specifies the destination for the data. 1.26 + * @param aTarget 1.27 + * specifies the thread on which the copy will occur. a null value 1.28 + * is permitted and will cause the copy to occur on an unspecified 1.29 + * background thread. 1.30 + * @param aSourceBuffered 1.31 + * true if aSource implements ReadSegments. 1.32 + * @param aSinkBuffered 1.33 + * true if aSink implements WriteSegments. 1.34 + * @param aChunkSize 1.35 + * specifies how many bytes to read/write at a time. this controls 1.36 + * the granularity of the copying. it should match the segment size 1.37 + * of the "buffered" streams involved. 1.38 + * @param aCloseSource 1.39 + * true if aSource should be closed after copying. 1.40 + * @param aCloseSink 1.41 + * true if aSink should be closed after copying. 1.42 + * 1.43 + * NOTE: at least one of the streams must be buffered. If you do not know 1.44 + * whether your streams are buffered, you should use nsIAsyncStreamCopier2 1.45 + * instead. 1.46 + */ 1.47 + void init(in nsIInputStream aSource, 1.48 + in nsIOutputStream aSink, 1.49 + in nsIEventTarget aTarget, 1.50 + in boolean aSourceBuffered, 1.51 + in boolean aSinkBuffered, 1.52 + in unsigned long aChunkSize, 1.53 + in boolean aCloseSource, 1.54 + in boolean aCloseSink); 1.55 + 1.56 + /** 1.57 + * asyncCopy triggers the start of the copy. The observer will be notified 1.58 + * when the copy completes. 1.59 + * 1.60 + * @param aObserver 1.61 + * receives notifications. 1.62 + * @param aObserverContext 1.63 + * passed to observer methods. 1.64 + */ 1.65 + void asyncCopy(in nsIRequestObserver aObserver, 1.66 + in nsISupports aObserverContext); 1.67 +};