Visit Mozilla.org

nsIAsyncStreamCopier

From MDC


Contents

nsIAsyncStreamCopier is defined in netwerk/base/public/nsIAsyncStreamCopier.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.8).

Inherits from: nsIRequest

[edit] Method overview

void init(in nsIInputStream aSource, in nsIOutputStream aSink, in nsIEventTarget aTarget, in boolean aSourceBuffered, in boolean aSinkBuffered, in unsigned long aChunkSize);
void asyncCopy(in nsIRequestObserver aObserver, in nsISupports aObserverContext);

[edit] Methods

[edit] init()

Initialize the stream copier.

  void init(
     in nsIInputStream aSource,
     in nsIOutputStream aSink,
     in nsIEventTarget aTarget,
     in boolean aSourceBuffered,
     in boolean aSinkBuffered,
     in unsigned long aChunkSize
  );
[edit] Parameters
aSource
Contains the data to be copied.
aSink
Specifies the destination for the data.
aTarget
specifies the thread on which the copy will occur. a null value is permitted and will cause the copy to occur on an unspecified background thread.
aSourceBuffered
true if aSource implements ReadSegments.
aSinkBuffered
true if aSink implements WriteSegments.
aChunkSize
specifies how many bytes to read/write at a time. This controls the granularity of the copying. It should match the segment size of the "buffered" streams involved.

[edit] asyncCopy()

asyncCopy triggers the start of the copy. The observer will be notified when the copy completes.

  void asyncCopy(
     in nsIRequestObserver aObserver,
     in nsISupports aObserverContext
  );
[edit] Parameters
aObserver
Receives notifications.
aObserverContext
Passed to observer methods.