nsIAsyncStreamCopier 编辑

netwerk/base/public/nsIAsyncStreamCopier.idlScriptable 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:68 次

字数:3945

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文