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 );
Exception Type | Condition |
---|---|
IOException | An I/O error occurs. |
NotSupportedException | The stream does not support both writing and seeking. |
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.