Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-06 Thread Marcos Douglas
On Tue, Sep 6, 2016 at 7:04 AM, Graeme Geldenhuys wrote: > On 2016-09-05 21:32, Marcos Douglas wrote: >> Ok, now I understand how TBase64DecodingStream works. > > Don't feel alone. I always get my first implementation of using > TBase64Decoding/Encoding wrong. So much so, that I annotated my FCL I

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-06 Thread Marcos Douglas
On Mon, Sep 5, 2016 at 9:07 PM, Graeme Geldenhuys wrote: > See the tiCompressZLib.pas unit included with tiOPF. It supports Stream, > Buffer, String and File compress/decompress functionality using ZLib. I > believe GZip and ZLib use the same algorithms. > > > https://sourceforge.net/p/tiopf/code

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-06 Thread Graeme Geldenhuys
On 2016-09-05 21:32, Marcos Douglas wrote: > Ok, now I understand how TBase64DecodingStream works. Don't feel alone. I always get my first implementation of using TBase64Decoding/Encoding wrong. So much so, that I annotated my FCL INF documentation with a working code example. :-) Regards, Grae

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Graeme Geldenhuys
On 2016-09-04 17:08, Marcos Douglas wrote: > I have streams compressed using GZip. I get these streams from WebServices. > So, how can I decompress these streams only in memory? See the tiCompressZLib.pas unit included with tiOPF. It supports Stream, Buffer, String and File compress/decompress fun

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Marcos Douglas
On Mon, Sep 5, 2016 at 4:43 PM, Marcos Douglas wrote: > On Mon, Sep 5, 2016 at 4:33 PM, Michael Van Canneyt > wrote: >> >> What is the stream content ? TGZFile or simply compressed ? If it is >> TGZFile, then the header must be skipped before uncompressing data. > > Simply compressed. > The examp

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Marcos Douglas
On Mon, Sep 5, 2016 at 4:33 PM, Michael Van Canneyt wrote: > > What is the stream content ? TGZFile or simply compressed ? If it is > TGZFile, then the header must be skipped before uncompressing data. Simply compressed. The example is using a file, but the real app uses streams in memory. I can

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Michael Van Canneyt
On Mon, 5 Sep 2016, Marcos Douglas wrote: On Mon, Sep 5, 2016 at 3:09 PM, Marcos Douglas wrote: On Mon, Sep 5, 2016 at 2:50 AM, Michael Van Canneyt wrote: As far as I know these things can be done with all the FPC classes as well ? The implementation in base64 unit can perfectly do everyth

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Marcos Douglas
On Mon, Sep 5, 2016 at 3:09 PM, Marcos Douglas wrote: > On Mon, Sep 5, 2016 at 2:50 AM, Michael Van Canneyt > wrote: >> As far as I know these things can be done with all the FPC classes as well ? >> The implementation in base64 unit can perfectly do everything in memory. >> And ZUncompressStream

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Marcos Douglas
On Mon, Sep 5, 2016 at 2:50 AM, Michael Van Canneyt wrote: > As far as I know these things can be done with all the FPC classes as well ? > The implementation in base64 unit can perfectly do everything in memory. > And ZUncompressStream can be done with TDecompressionStream ? Well, if FPC can do

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Marcos Douglas
On Sun, Sep 4, 2016 at 8:11 PM, Michalis Kamburelis wrote: > It seems you already have a solution, but here's another one:) > > In Castle Game Engine, I have a unit CastleZStream that provides > TGZFileStream that can compress/decompress in memory. It uses the > CastleGzioInternal unit, which is a

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread Marcos Douglas
On Sun, Sep 4, 2016 at 7:37 PM, silvioprog wrote: > I'm on the phone, but looking this part it seems that base64 unconversion > can be done directly in memory too. I can try it after... I'm working directly in memory. The example is using files, but just in example. Thanks. Marcos Douglas _

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-05 Thread silvioprog
On Mon, Sep 5, 2016 at 2:50 AM, Michael Van Canneyt wrote: [...] > As far as I know these things can be done with all the FPC classes as well > ? > The implementation in base64 unit can perfectly do everything in memory. > And ZUncompressStream can be done with TDecompressionStream ? > Perfect!

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Michael Van Canneyt
On Sun, 4 Sep 2016, Marcos Douglas wrote: Ok, it works now. For the records, I've used the lib http://www.gocher.me/GZIP (Silvio's tip) and the function Base64Decode from WST framework http://svn.code.sf.net/p/lazarus-ccr/svn/wst/trunk/ For some reason the function DecodeBase64 from Synapse

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Michalis Kamburelis
2016-09-04 18:08 GMT+02:00 Marcos Douglas : > I have streams compressed using GZip. I get these streams from WebServices. > So, how can I decompress these streams only in memory? It seems you already have a solution, but here's another one:) In Castle Game Engine, I have a unit CastleZStream tha

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread silvioprog
On Sep 4, 2016 5:29 PM, "Marcos Douglas" wrote: > > Ok, it works now. Great! > For the records, I've used the lib http://www.gocher.me/GZIP (Silvio's > tip) and the function Base64Decode from WST framework > http://svn.code.sf.net/p/lazarus-ccr/svn/wst/trunk/ > > For some reason the function Dec

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Marcos Douglas
Ok, it works now. For the records, I've used the lib http://www.gocher.me/GZIP (Silvio's tip) and the function Base64Decode from WST framework http://svn.code.sf.net/p/lazarus-ccr/svn/wst/trunk/ For some reason the function DecodeBase64 from Synapse doesn't work. It receives an AnsiString. Instea

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Marcos Douglas
On Sun, Sep 4, 2016 at 4:46 PM, silvioprog wrote: > On Sun, Sep 4, 2016 at 1:08 PM, Marcos Douglas wrote: >> >> Hi, >> >> I have streams compressed using GZip. I get these streams from >> WebServices. >> So, how can I decompress these streams only in memory? > > [...] > > Some time ago I needed s

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Marcos Douglas
On Sun, Sep 4, 2016 at 4:29 PM, José Mejuto wrote: > El 04/09/2016 a las 19:17, Marcos Douglas escribió: > >> try >> Buf.LoadFromFile('data.txt'); >> showmessage(inttostr(ExtractStream(Buf, Buf2))); //<< result is 0, ie, >> OK >> Buf2.SaveToFile('result.txt'); > > >> There is no erro

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread José Mejuto
El 04/09/2016 a las 19:17, Marcos Douglas escribió: try Buf.LoadFromFile('data.txt'); showmessage(inttostr(ExtractStream(Buf, Buf2))); //<< result is 0, ie, OK Buf2.SaveToFile('result.txt'); There is no error, but Buf2 is empty. Hello, I'm not sure but I think that code at le

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Marcos Douglas
On Sun, Sep 4, 2016 at 1:37 PM, Ewald wrote: > On 04/09/16 18:08, Marcos Douglas wrote: >> Hi, >> >> I have streams compressed using GZip. I get these streams from WebServices. >> So, how can I decompress these streams only in memory? > > Perhaps have a look at zlibar. The main, and only, unit con

Re: [fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Ewald
On 04/09/16 18:08, Marcos Douglas wrote: > Hi, > > I have streams compressed using GZip. I get these streams from WebServices. > So, how can I decompress these streams only in memory? Perhaps have a look at zlibar. The main, and only, unit contains these functions: function CompressStream(InStre

[fpc-pascal] GZip - Stream decompress only in memory

2016-09-04 Thread Marcos Douglas
Hi, I have streams compressed using GZip. I get these streams from WebServices. So, how can I decompress these streams only in memory? I've tried to use zstream unit, that contains TGZFileStream class. Unfortunately this class works only using files. Then I saved the stream in a file (data.txt) a