UnmanagedMemoryStream.SetLength(Int64) Método
Definição
Define o comprimento de um fluxo como um valor especificado.Sets the length of a stream to a specified value.
public:
override void SetLength(long value);
public override void SetLength (long value);
override this.SetLength : int64 -> unit
Public Overrides Sub SetLength (value As Long)
Parâmetros
- value
- Int64
O comprimento do fluxo.The length of the stream.
Exceções
Ocorreu um erro de E/S.An I/O error has occurred.
O fluxo está fechado.The stream is closed.
A memória subjacente não oferece suporte à gravação.The underlying memory does not support writing.
- ou --or-
É feita uma tentativa de gravar no fluxo e a propriedade CanWrite é false.An attempt is made to write to the stream and the CanWrite property is false.
O value especificado excede a capacidade do fluxo.The specified value exceeds the capacity of the stream.
- ou --or-
O value especificado é negativo.The specified value is negative.
Comentários
Se o valor fornecido for menor que o comprimento atual do fluxo, o fluxo será truncado.If the given value is less than the current length of the stream, the stream is truncated. Se o valor especificado for maior do que o comprimento atual do fluxo, o fluxo será expandido.If the given value is larger than the current length of the stream, the stream is expanded. Se o fluxo for expandido, o conteúdo do fluxo entre o antigo e o novo comprimento será indefinido.If the stream is expanded, the contents of the stream between the old and the new lengths are undefined.
Um fluxo deve dar suporte à gravação e à busca do SetLength para funcionar.A stream must support both writing and seeking for SetLength to work.