nsISeekableStream

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

Constant Value Description
NS_SEEK_SET 0 Specifies that the offset is relative to the start of the stream.
NS_SEEK_CUR 1 Specifies that the offset is relative to the current position in the stream.
NS_SEEK_END 2 Specifies 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.

Document Tags and Contributors

 Contributors to this page: Sheppy, serge, Neil, trevorh
 Last updated by: Sheppy,