EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Unpack GZIP string to a file

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#36381
Posted: 04/01/2016 14:28:28
by Eduardo Helminsky (Standard support level)
Joined: 08/20/2010
Posts: 102

Hi

I am trying to figure out how to unpak a string in GZIP format to a file.

1) I have received an string from a webservice in Base64 format.
2) I convert this string using MimeDecodeString
3) Then the code unpak but how the component knows that it is in GZip format ?

procedure ExtractGZip(cZip: String; cPath: String);
var xZip: TElZipReader;
xStr: TStringStream;
begin
cZip := MimeDecodeString(cZip);
xStr := TStringStream.Create;
xStr.WriteString(cZip);
xStr.Seek(0,0);
xZip := TElZipReader.Create(nil);
try
xZip.Open(xStr);
xZip.Extract('*.*',cPath);
finally
FreeAndNil(xZip);
end;
end;

I do not know if I am doing the right thing.

Eduardo
#36383
Posted: 04/01/2016 17:24:39
by Ken Ivanov (EldoS Corp.)

Hi Eduardo,

Thank you for contacting us.

Typically ZIP/GZip streams have special headers that let the processing application identify that the stream contains data of the appropriate type.

Could you please let me know what exactly you are trying to do? Do you want to check whether the decoded data are valid ZIP/GZip data before passing it to e.g. TElZipReader?

Ken
#36384
Posted: 04/02/2016 06:15:59
by Eugene Mayevski (EldoS Corp.)

Actually GZip stream can not be handled with TElZIPReader component.

In SecureBlackbox 14 we have TElGZIPReader component, which can handle GZIP.


Sincerely yours
Eugene Mayevski
#36393
Posted: 04/04/2016 13:07:20
by Eduardo Helminsky (Standard support level)
Joined: 08/20/2010
Posts: 102

Thanks Ken and Eugene for the answers.

It was my mistake because I was reading the help from version 12 and what I need is TElGZipReader. I will use this and come back if needed.

Thanks again.

Reply

Statistics

Topic viewed 1630 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!