nsIAsyncStreamCopier 编辑
netwerk/base/public/nsIAsyncStreamCopier.idl
Scriptable 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
ifaSource
implementsnsIInputStream.readSegments()
.aSinkBuffered
true
ifaSink
implementsnsIInputStream.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
ifaSource
should be closed after copying.aCloseSink
true
ifaSink
should be closed after copying.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论