System.IO.BufferedStream.SetLength Method

Sets the length of the buffered stream.

Syntax

public override void SetLength (long value)

Parameters

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

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 lengths are not defined.

SetLength flushes any buffered writes if necessary.

A stream must support both writing and seeking for SetLength to work.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0