LucaMs Expert Licensed User Longtime User Apr 15, 2014 #1 It is a question in the Italian forum. http://www.b4x.com/android/forum/threads/httpjob-e-gzip.39937/ I have tried to help by creating the app that I am attaching but it does not work. AsyncUnGzip do not "creates" any files. I guess use File.WriteString is wrong and that the file type is not recognized as Gzip. Suggestions? Thanks Attachments LM_Demo.zip LM_Demo.zip 11.9 KB · Views: 649
It is a question in the Italian forum. http://www.b4x.com/android/forum/threads/httpjob-e-gzip.39937/ I have tried to help by creating the app that I am attaching but it does not work. AsyncUnGzip do not "creates" any files. I guess use File.WriteString is wrong and that the file type is not recognized as Gzip. Suggestions? Thanks
DonManfred Expert Licensed User Longtime User Apr 17, 2014 #21 Informatix said: It is not a valid archive. I don't know what format this file use but it is neither Gzip nor Zip (and I don't even think it's an archive; that looks like an encrypted string). Click to expand... http://ypool.net/api/personal_stats?key=nIcvhzn!4orRtYFkbWps&coinType=XPM: You can have a look at example in #1. There is the url which is viewable in browser (webview and browser on pc too). In 2. try the result from this url is loaded with httputil2 and saved to sdcard... THIS file is not what you see in webview. My Firefox (LiveHeaders) states that the content of this url is compressed with GZIP. Last edited: Apr 17, 2014 Upvote 0
Informatix said: It is not a valid archive. I don't know what format this file use but it is neither Gzip nor Zip (and I don't even think it's an archive; that looks like an encrypted string). Click to expand... http://ypool.net/api/personal_stats?key=nIcvhzn!4orRtYFkbWps&coinType=XPM: You can have a look at example in #1. There is the url which is viewable in browser (webview and browser on pc too). In 2. try the result from this url is loaded with httputil2 and saved to sdcard... THIS file is not what you see in webview. My Firefox (LiveHeaders) states that the content of this url is compressed with GZIP.
Informatix Expert Licensed User Longtime User Apr 17, 2014 #22 DonManfred said: You can have a look at example in #1. There is the url which is viewable in browser (webview and browser on pc too). In 2. try the result from this url is loaded with httputil2 and saved to sdcard... THIS file is not what you see in webview. My Firefox (LiveHeaders) states that the content of this url is compressed with GZIP. Click to expand... The magic number of this file is 1F EF instead of the expected 1F 8B for a Gzip file. You should check if there's not a problem of charset conversion. Upvote 0
DonManfred said: You can have a look at example in #1. There is the url which is viewable in browser (webview and browser on pc too). In 2. try the result from this url is loaded with httputil2 and saved to sdcard... THIS file is not what you see in webview. My Firefox (LiveHeaders) states that the content of this url is compressed with GZIP. Click to expand... The magic number of this file is 1F EF instead of the expected 1F 8B for a Gzip file. You should check if there's not a problem of charset conversion.
Erel B4X founder Staff member Licensed User Longtime User Apr 17, 2014 #23 The problem is in the length block (last 4 bytes): You can see it in 7zip that it reports 4gb for the unpacked length. Upvote 0
The problem is in the length block (last 4 bytes): You can see it in 7zip that it reports 4gb for the unpacked length.
Informatix Expert Licensed User Longtime User Apr 17, 2014 #24 Ok, I finally used the following code as Job.GetString in the provided example does not return the raw data (I'm a bit slow today): Code: Copy Dim out As OutputStream = File.OpenOutput(File.DirDefaultExternal, "demo.gzip", False) File.Copy2(job.GetInputStream, out) out.Close The magic number at the beginning is the right one so it's a Gzip file indeed, but as Erel said above, there's something wrong at the end. Upvote 0
Ok, I finally used the following code as Job.GetString in the provided example does not return the raw data (I'm a bit slow today): Code: Copy Dim out As OutputStream = File.OpenOutput(File.DirDefaultExternal, "demo.gzip", False) File.Copy2(job.GetInputStream, out) out.Close The magic number at the beginning is the right one so it's a Gzip file indeed, but as Erel said above, there's something wrong at the end.
LucaMs Expert Licensed User Longtime User Apr 17, 2014 #25 Erel said: The problem is in the length block (last 4 bytes): You can see it in 7zip that it reports 4gb for the unpacked length. Click to expand... it.wikipedia.org Col termine gzip si fa spesso riferimento all'omonimo formato di file, che è composto da: una intestazione di 10 byte contenente un magic number, una versione del programma e un timestamp; intestazioni addizionali facoltative, come ad esempio il nome originale del file; un corpo centrale, contenente un insieme di dati compressi; 8 byte finali contenenti un checksum di tipo CRC-32 dei dati e la loro lunghezza originaria. ------------------------------------------------------------------------------------------------------- "gzip" is often also used to refer to the gzip file format, which is: a 10-byte header, containing a magic number (1f 8b), a version number and a timestamp optional extra headers, such as the original file name, a body, containing a DEFLATE-compressed payload an 8-byte footer, containing a CRC-32 checksum and the length of the original uncompressed data _____________________________________________ Too much effort for this problem and too little for my quiz . I'm just kidding. I hope that the guy appreciates your interest. Upvote 0
Erel said: The problem is in the length block (last 4 bytes): You can see it in 7zip that it reports 4gb for the unpacked length. Click to expand... it.wikipedia.org Col termine gzip si fa spesso riferimento all'omonimo formato di file, che è composto da: una intestazione di 10 byte contenente un magic number, una versione del programma e un timestamp; intestazioni addizionali facoltative, come ad esempio il nome originale del file; un corpo centrale, contenente un insieme di dati compressi; 8 byte finali contenenti un checksum di tipo CRC-32 dei dati e la loro lunghezza originaria. ------------------------------------------------------------------------------------------------------- "gzip" is often also used to refer to the gzip file format, which is: a 10-byte header, containing a magic number (1f 8b), a version number and a timestamp optional extra headers, such as the original file name, a body, containing a DEFLATE-compressed payload an 8-byte footer, containing a CRC-32 checksum and the length of the original uncompressed data _____________________________________________ Too much effort for this problem and too little for my quiz . I'm just kidding. I hope that the guy appreciates your interest.
Informatix Expert Licensed User Longtime User Apr 17, 2014 #26 I compressed the JSON string with Gzip and compared the result in hexadecimal. The footer is wrong (4 bytes instead of the 8 expected). Upvote 0
I compressed the JSON string with Gzip and compared the result in hexadecimal. The footer is wrong (4 bytes instead of the 8 expected).
LucaMs Expert Licensed User Longtime User Apr 17, 2014 #27 Unfortunately, this is one of the many things that I do not mean! I wonder how he never has problems with Webview and VB.Net code Upvote 0
Unfortunately, this is one of the many things that I do not mean! I wonder how he never has problems with Webview and VB.Net code