Android Question Reading a zipped data stream

Discussion in 'Android Questions' started by morphe2011, Jul 13, 2015.

  1. morphe2011

    morphe2011 Member Licensed User

    Hello All
    A client has produced a wonderful api which works great . Most of the api is standard stuff that Job.GetString can handle. However at one point the stream is a zipped file . How do I get it and and save it as a zip so that I can open it and use it's contents?

    Most Thanks for any help.
  2. walterf25

    walterf25 Well-Known Member Licensed User

    There is a library to read and write zip files, can't remember the name of it now, but do a search and you should be able to find it.

  3. morphe2011

    morphe2011 Member Licensed User

    Thank you for the reply. I use the MLfiles library for reading and writing and it works great. My issue is in saving the file as it comes in as a file rather than a string. Normally I use FTP to download files but this data is very sensitive so that is not an option.

    Writing as a string produces an invalid zip and yes I'm already testing for Job.Success
    This is a sample of code:
    Sub JobDone (Job As HttpJob)
    Dim sResults As String
    If Job.JobName="hBook" Then


    End If
    End sub

  4. DonManfred

    DonManfred Expert Licensed User

  5. morphe2011

    morphe2011 Member Licensed User


    Thank you for the link. I've looked at it before and it is a great library however I'm either brain farting or it's the first signs of dementia (probably the latter) . B4a is and has been great. I can figure out 98% on my own but on this one I'm drawing a blank. If it was or I'd know how to proceed. Please see my reply to Walter. Any help or direction would be most appreciated.
  6. DonManfred

    DonManfred Expert Licensed User

    In your JobDone inside job.success

    OutStream = File.OpenOutput(ed.sAppPath, ""False
    File. Copy2(Job.GetInputStream,OutStream) ' save the file
    to save the job-result to a file
    morphe2011 likes this.
  7. morphe2011

    morphe2011 Member Licensed User

    Yep a brain fart.
    Most thanks.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice