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.SetLength

Sets the length of the current stream.

[Visual Basic]
MustOverride Public Sub SetLength( _
   ByVal value As Long _
)
[C#]
public abstract void SetLength(
   long value
);
[C++]
public: virtual void SetLength(
   __int64 value
) = 0;
[JScript]
public abstract function SetLength(
   value : long
);

Parameters

value
An integer indicating the desired length of the current stream in bytes.

Exceptions

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

Remarks

If the specified value is less than the current length of the stream, the stream is truncated. If the specified value is larger than the current length of the stream, the stream is expanded. If the stream is expanded, the contents of the stream between the old and the new length are not defined.

The default implementation simply throws a NotSupportedException. A subclass of Stream must support both writing and seeking for SetLength to be operational.

See Also

Stream Class | Stream Members | System.IO Namespace