michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsIRequest.idl" michael@0: michael@0: interface nsIInputStream; michael@0: interface nsIOutputStream; michael@0: interface nsIRequestObserver; michael@0: interface nsIEventTarget; michael@0: michael@0: [scriptable, uuid(a5b2decf-4ede-4801-8b38-e5fe5db46bf2)] michael@0: interface nsIAsyncStreamCopier2 : nsIRequest michael@0: { michael@0: /** michael@0: * Initialize the stream copier. michael@0: * michael@0: * If neither the source nor the sink are buffered, buffering will michael@0: * be automatically added to the sink. michael@0: * michael@0: * michael@0: * @param aSource michael@0: * contains the data to be copied. michael@0: * @param aSink michael@0: * specifies the destination for the data. michael@0: * @param aTarget michael@0: * specifies the thread on which the copy will occur. a null value michael@0: * is permitted and will cause the copy to occur on an unspecified michael@0: * background thread. michael@0: * @param aChunkSize michael@0: * specifies how many bytes to read/write at a time. this controls michael@0: * the granularity of the copying. it should match the segment size michael@0: * of the "buffered" streams involved. michael@0: * @param aCloseSource michael@0: * true if aSource should be closed after copying (this is generally michael@0: * the desired behavior). michael@0: * @param aCloseSink michael@0: * true if aSink should be closed after copying (this is generally michael@0: * the desired behavior). michael@0: */ michael@0: void init(in nsIInputStream aSource, michael@0: in nsIOutputStream aSink, michael@0: in nsIEventTarget aTarget, michael@0: in unsigned long aChunkSize, michael@0: in boolean aCloseSource, michael@0: in boolean aCloseSink); michael@0: michael@0: /** michael@0: * asyncCopy triggers the start of the copy. The observer will be notified michael@0: * when the copy completes. michael@0: * michael@0: * @param aObserver michael@0: * receives notifications. michael@0: * @param aObserverContext michael@0: * passed to observer methods. michael@0: */ michael@0: void asyncCopy(in nsIRequestObserver aObserver, michael@0: in nsISupports aObserverContext); michael@0: };