NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Stream.Seek

Sets the position within the current stream.

[Visual Basic]
MustOverride Public Function Seek( _
   ByVal offset As Long, _
   ByVal origin As SeekOrigin _
) As Long
[C#]
public abstract long Seek(
   long offset,
   SeekOrigin origin
);
[C++]
public: virtual __int64 Seek(
   __int64 offset,
   SeekOrigin origin
) = 0;
[JScript]
public abstract function Seek(
   offset : long,
   origin : SeekOrigin
) : long;

Parameters

offset
A byte offset relative to origin. If offset is negative, the new position will precede the position specified by origin by the number of bytes specified by offset. If offset is zero, the new position will be the position specified by origin. If offset is positive, the new position will follow the position specified by origin by the number of bytes specified by offset.
origin
A field of SeekOrigin indicating the reference point from which the new position is to be obtained.

Return Value

The new position within the current stream.

Exceptions

Exception Type Condition
IOException An I/O error occurs.
NotSupportedException The stream does not support seeking.

Remarks

Stream subclasses that support seeking should override this method to provide the functionality described above. The default implementation simply throws a NotSupportedException.The position cannot be set more than one byte beyond the end of the stream. You can set the position to just beyond the last byte so you can append to the file. Opening a new file and then writing to it requires this.

See Also

Stream Class | Stream Members | System.IO Namespace