Base64 + Gzip is a widely adopted method for efficient and text-safe data transmission in web APIs and network protocols. the WEBAPI interface compresses a large json string through gzip and returns it as a base64 encoded string. Therefore it needs to be unzipped. I've done it in vb.net, but b4x always fails.
LINE 6 ERROR TIPS: Caused by: java.util.zip.ZipException: Not in GZIP format
It's not clear if it's my method that's wrong or if it's a compatibility issue.
Attached are the test items
================A complete solution===================
This is the correct compression and compression code that supports gzip and zlib compression algorithms. In the second attachment is an OK test item.
www.b4x.com
DecompressString:
Sub DecompressString( base64 As String)
Dim compress As CompressedStreams
Dim su As StringUtils
Dim compressed(), decompressed() As Byte
compressed = su.DecodeBase64(base64)
decompressed= compress.DecompressBytes(compressed, "gzip")
xui.MsgboxAsync(BytesToString(decompressed,0, decompressed.Length, "UTF8"), "")
End Sub
It's not clear if it's my method that's wrong or if it's a compatibility issue.
Attached are the test items
================A complete solution===================
This is the correct compression and compression code that supports gzip and zlib compression algorithms. In the second attachment is an OK test item.
[B4X]How to compress and decompress strings using gzip.
Base64 + Gzip is a widely adopted method for efficient and text-safe data transmission in web APIs and network protocols. the WEBAPI interface compresses a large json string through gzip and returns it as a base64 encoded string. Therefore it needs to be unzipped. I've done it in vb.net, but b4x...

Attachments
Last edited: