Can multiple files be compressed into one gzip? How can I do it? I've tried several things, for example:
B4X:
Dim compress As CompressedStreams
.
.
.
out1=File.OpenOutput("",sFile,False)
out = File.Openoutput("", sc, True)
out=compress.WrapoutputStream(out1,"gzip")
WriteStringToStream(out, s)
With that I get 0 byte file.
I've also tried OpenInput for the file to compress (it has more sense to me since I'm not writing there) but I got errors (wrapinputstream returns an inputstream, thing I don't get it because I need an outputstream to write the file, right?)
What is WriteStringToStream? Don't use strings when working with bytes. They are not the same.
The problem with gzip is that it will create a single compressed "blob". It will be difficult to decompress it and return multiple files. You should instead use zip compression with the Archiver library.
That function is the one on the documentation's example:
B4X:
Sub WriteStringToStream(Out As OutputStream, s As String)
Dim t As TextWriter
t.Initialize(Out)
t.Write(s)
t.Close 'Closes the internal stream as well
End Sub