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!

BufferedStream.SetLength

Sets the length of the buffered stream.

[Visual Basic]
Overrides Public Sub SetLength( _
   ByVal value As Long _
)
[C#]
public override void SetLength(
   long value
);
[C++]
public: override void SetLength(
   __int64 value
);
[JScript]
public override function SetLength(
   value : long
);

Parameters

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

Exceptions

Exception Type Condition
ArgumentOutOfRangeException value is less than zero.
IOException The stream is not open or is null.
NotSupportedException The stream does not support both writing and seeking.

Remarks

The buffer is flushed before setting the length of the underlying data source or repository. If the specified value is less than the current length of the buffered stream, the buffered stream is truncated. If the specified value is larger than the current length of the buffered stream, the buffered stream is expanded. If the buffered stream is expanded, the contents of the buffered stream between the old and the new length are not defined.

The default implementation of SetLength copies any data previously written to the buffer to the underlying data source or repository. Seek is called to decrement the position within the underlying data source or repository by the number of unread bytes (if any) previously copied from the underlying data source or repository to the buffer. Then SetLength sets the length in bytes of the stream.

See Also

BufferedStream Class | BufferedStream Members | System.IO Namespace