nsIFileOutputStream 编辑

netwerk/base/public/nsIFileStreams.idlScriptable This interface is an output stream that lets you stream to a file. Inherits from: nsIOutputStream Last changed in Gecko 1.7

Method overview

void init(in nsIFile file, in long ioFlags, in long perm, in long behaviorFlags);

Constants

Behavior flag constants

ConstantValueDescription
DEFER_OPEN1<<0See the same constant in nsIFileInputStream. The deferred open will be performed when one of the following is called:
  • Seek()
  • Tell()
  • Write()
  • Flush()

DEFER_OPEN is useful if we use the stream on a background thread, so that the opening and possible stating of the file happens there as well.

Note: Using this flag results in the file not being opened during the call to init(). This means that any errors that might happen when this flag is not set would happen during the first write, and if the file is to be created, it will not appear on the disk until the first write.

Methods

init()

void init(
  in nsIFile file,
  in long ioFlags,
  in long perm,
  in long behaviorFlags
);
Parameters
file
File to write to (must QI to nsILocalFile)
ioFlags
File open flags listed are listed in the PR_Open() documentation. Use -1 to open the file in default mode (PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE).
perm
File mode bits are described in the PR_Open documentation. If set to -1 the default permissions (0664) will be used.
behaviorFlags
Flags specifying various behaviors of the class; see Behavior flag constants above.

See also

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

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

发布评论

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

词条统计

浏览:114 次

字数:3867

最后编辑:7年前

编辑次数:0 次

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