nsISeekableStream 编辑

xpcom/io/nsISeekableStream.idlScriptable Provides seeking support in data streams. Inherits from: nsISupports Last changed in Gecko 1.7

Method overview

void seek(in long whence, in long long offset);
void setEOF();
long long tell();

Constants

ConstantValueDescription
NS_SEEK_SET0Specifies that the offset is relative to the start of the stream.
NS_SEEK_CUR1Specifies that the offset is relative to the current position in the stream.
NS_SEEK_END2Specifies that the offset is relative to the end of the stream.

Methods

seek()

This method moves the stream offset of the stream implementing this interface.

void seek(
  in long whence,
  in long long offset
);
Parameters
whence
Specifies how to interpret the 'offset' parameter in setting the stream offset associated with the implementing stream, according to the table of constants above.
offset
Specifies a value, in bytes, that is used in conjunction with the 'whence' parameter to set the stream offset of the implementing stream. A negative value causes seeking in the reverse direction.
Exceptions thrown
NS_BASE_STREAM_CLOSED
If called on a closed stream.

setEOF()

This method truncates the stream at the current offset.

void setEOF();
Parameters

None.

Exceptions thrown
NS_BASE_STREAM_CLOSED
If called on a closed stream.

tell()

This method reports the current offset, in bytes, from the start of the stream.

long long tell();
Parameters

None.

Return value

The current offset, in bytes, from the start of the stream.

Exceptions thrown
NS_BASE_STREAM_CLOSED
If called on a closed stream.

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

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

发布评论

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

词条统计

浏览:28 次

字数:3742

最后编辑:6 年前

编辑次数:0 次

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