nsIAsyncStreamCopier

This interface is used to copy the contents of one stream to another.
Inherits from: nsIRequest Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)

Method overview

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

Methods

asyncCopy()

Starts the copy operation. The specified observer is notified when the copy completes.

void asyncCopy(
  in nsIRequestObserver aObserver,
  in nsISupports aObserverContext
);
Parameters
aObserver
Receives notifications.
aObserverContext
The object to receive notifications with information about the progress of the copy operation.

init()

Initializes the stream copier.

Note: At least one of the streams must be buffered.

void init(
  in nsIInputStream aSource,
  in nsIOutputStream aSink,
  in nsIEventTarget aTarget,
  in boolean aSourceBuffered,
  in boolean aSinkBuffered,
  in unsigned long aChunkSize,
  in boolean aCloseSource,
  in boolean aCloseSink
);
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 causes the copy to occur on an unspecified background thread.
aSourceBuffered
true if aSource implements nsIInputStream.readSegments().
aSinkBuffered
true if aSink implements nsIInputStream.writeSegments() .
aChunkSize
Specifies how many bytes to read and write at a time. This controls the granularity of the copy operation. This value should match the segment size of any buffered streams involved in the operation.
aCloseSource
true if aSource should be closed after copying.
aCloseSink
true if aSink should be closed after copying.

See also