iOS Question Download file and decompress

GiulioVale

Active Member
Licensed User
Longtime User
Hi Erel,
any suggestion about b4a to b4i for this line of code

B4X:
    Log("Job completed: " & Job.Success)
    Dim Inizio As InputStream
    Dim Out As OutputStream
    Dim CS As CompressedStreams
  
    lblDownloadProgress1.Text ="Decompressione in corso..."   
    DoEvents
    Inizio = CS.WrapInputStream(Job.GetInputStream, "gzip")
    Out =  File.OpenOutput(File.DirRootExternal & "/" & Main.directory_programma, Main.nome_file_indirizzo,False )
    File.Copy2( Inizio,  Out)
    Out.Close
    Job.Release
   
    lblDownloadProgress1.Text ="Decompressione completata"   
    DoEvents

thanks
 

GiulioVale

Active Member
Licensed User
Longtime User
Uhm strange your method work
B4X:
Dim CS As CompressedStreams
  Log("Decompressione in corso...")
  
   Dim data() As Byte = CS.DecompressBytes(Bit.InputStreamToBytes(j.GetInputStream), "gzip")
  Dim input As InputStream
  input.InitializeFromBytesArray(data, 0, data.Length)

  Dim output As OutputStream
  output =  File.OpenOutput(File.DirLibrary  & "/" & directory_programma, nome_file_indirizzo,False )
  File.Copy2( input,  output)
  output.Close  
   Log("Decompressione completata")

My file is correctly download and decompress.
 
Upvote 0

drponciano

Member
Licensed User
Longtime User
Hello all! I'm trying to use inputstream to receive bytes from s socket. I did this in Android using inputstream.BytesAvailable but this property seems to be absent from the IOS implementation. What can be used instead?
 
Upvote 0
Top