Hi,
i'm trying to compress/decompress data from an asp.net web service to a b4a client.
here's the .net part :
and b4a part :
but got errors like these :
java.io.IOException: unknown format (magic number 7364)
java.io.IOException: unknown format (magic number 3448)
java.io.IOException: unknown format (magic number ef1f)
any suggestion?
i'm trying to compress/decompress data from an asp.net web service to a b4a client.
here's the .net part :
B4X:
Context.Response.Expires = -1
'Context.Response.ContentType = "application/x-gzip"
Context.Response.ContentType = "application/json"
Context.Response.ContentEncoding = System.Text.Encoding.UTF8
Context.Response.Write(GZIPCompress("Hello, This is a sample text."))
Function GZipCompress(ByVal s As String) As String
Dim bytes = Encoding.Unicode.GetBytes(s)
Using msi = New MemoryStream(bytes)
Using mso = New MemoryStream()
Using gs = New GZipStream(mso, CompressionMode.Compress)
msi.CopyTo(gs)
End Using
'Return Convert.ToBase64String(mso.ToArray())
Return Encoding.UTF8.GetString(mso.ToArray)
End Using
End Using
End Function
and b4a part :
B4X:
Dim sData As String
Dim cs As CompressedStreams
Dim In As InputStream
In = cs.WrapInputStream(Job.GetInputStream, "gzip")
Dim Reader As TextReader
Reader.Initialize(In)
sData = Reader.ReadAll
Log(sData)
but got errors like these :
java.io.IOException: unknown format (magic number 7364)
java.io.IOException: unknown format (magic number 3448)
java.io.IOException: unknown format (magic number ef1f)
any suggestion?