[fpc-devel] Readonly Memory Stream?

J. Gareth Moreton gareth at moreton-family.com
Wed Feb 13 22:34:33 CET 2019


 Hi guys,

 I too had to use such a stream.  Not so much that the stream was
read-only, but the memory was already allocated for some reason.  In my
case, I had a "TBufferStream", where my constructor had parameters to pass
in the start address and the maximum length.
 Given it seems to have many common use cases, I would say it's definitely
a class worth considering.

 Gareth aka. Kit

 On Wed 13/02/19 11:12 , Yuriy Sydorov jura at cp-lab.com sent:
 On 13.02.2019 11:40, LacaK wrote: 
 > and in code I use for example: 
 > 
 >     MS := TStaticMemoryStream.Create; 
 >     MS.SetPointer(buffer, bufferLen); 
 >     MS.Position := 0; 
 >     Bitmap.LoadFromStream(MS); 
 >     MS.Free; 

 Btw, you can omit "MS.Position := 0;", since it is already zero for a new
stream. 

 Yuriy. 
 _______________________________________________ 
 fpc-devel maillist - fpc-devel at lists.freepascal.org [1] 
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[2]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel 

 

Links:
------
[1] mailto:fpc-devel at lists.freepascal.org
[2] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190213/6d3f7400/attachment.html>


More information about the fpc-devel mailing list