



Este é uma função que permite copiar um Stram sem utilizar
Size ou Seek.
É necessário estar declarado System.Classes
Código Fonte:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | function CopyStream(const AStream: TStream): TMemoryStream; var LBuffer: TBytes; LCount: Integer; begin Result := TMemoryStream.Create; try SetLength(LBuffer, 1024 * 32); while True do begin LCount := AStream.Read(LBuffer, Length(LBuffer)); Result.Write(LBuffer, LCount); if LCount < Length(LBuffer) then break; end; except Result.Free; raise; end; end; |
Dúvidas ou sugestões deixe nos comentários do post.