B4A Library SD: ZipLibrary

Discussion in 'Additional libraries, classes and official updates' started by Star-Dust, Mar 17, 2018.

Tags:
  1. Star-Dust

    Star-Dust Expert Licensed User

    SD_ZipLibray

    Author: Star-Dust
    Version: 1.02
    • SD_ZipLibrary
      • Event
        • finish (Success as Boolean)
      • Functions:
        • Class_Globals As String
        • Initialize As String
          Initializes the object. You can add parameters to this method if needed.
        • IsInitialized As Boolean
          Verifica se l'oggetto sia stato inizializzato.
        • unZip (FileZip As String, OutPutFolder As String) As String
        • unZipList (FileZip As String) As List
        • Zip (FilesTxt As String(), FileZip As String) As String

    List file in to Zip
    Code:
    Dim UZ As SD_ZipLibrary
     
        UZ.Initialize
        
    Log("File: " & File.Exists(File.DirRootExternal,fileZipName))
        
    Dim L As List = UZ.unZipList(File.Combine(File.DirRootExternal,fileZipName))
    Unzip
    Code:
    Dim UZ As SD_ZipLibrary
        
        UZ.Initialize
        UZ.unZip(
    File.Combine(File.DirRootExternal,fileZipName),File.Combine(File.DirRootExternal,DestinationPath))

    ZIp files
    Code:
    Dim ZL As SD_ZipLibray
    Dim ListFiles as List
     
    ZL.Initialize
    ZL.Zip(ListFiles,ZipFileName)
     

    Attached Files:

    Last edited: Jul 15, 2018
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. Star-Dust

    Star-Dust Expert Licensed User

    Frankly I do not know, to create my application B4J I had to create a library to compress and decompress that B4J is not found.

    I used Inline Java with the native library java.util.zip. *;
    Then I thought about rewriting it for B4A, I did not even see if there were other Zip libraries in B4A.

    My library is very simple because I am very limited in java, I suppose @Informatix has created something more complete.

    Among other things, the source code of my library can be found within this application that I shared in the forum.

    So who wants to make changes can also have the source code.
     
    Last edited: Mar 18, 2018
    Peter Simpson and Erel like this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    Note that Archiver is also supported by B4J.
     
  5. Star-Dust

    Star-Dust Expert Licensed User

    Thanks, I was not sure and I solved this way.
    But good to know for future uses
     
  6. ilan

    ilan Expert Licensed User

    hi, @Star-Dust, your lib is working well for me. i have 2 questions.
    the zip that is created is also created with the folder scheme as in my phone so if i zip a file in filedireinternel i get all folders to the zip and i have to dig in the zip to find the file itself. would it be possible to filter those folders and add only the file to the zip so when i open it i see all files in it and not inside folders?

    question 2, it would be awesome to have a finish zip/unzip event that will be called when app has finished the job.

    thanx a lot, ilan

    btw. the difference between archiverplus and this lib is that archiverplus crashes on android 8+ and this one works ;)
     
  7. Star-Dust

    Star-Dust Expert Licensed User

    I believe it is possible to make selections and raise a decompression file event.I've simply used a native Java library, they are really 2 lines of code.
    But I have to look good, because I do not overdo myself like I did. :p

    Do you dare to java?
     
  8. ilan

    ilan Expert Licensed User

    can you post the class that you converted to b4a lib?

    thank you
     
  9. Star-Dust

    Star-Dust Expert Licensed User

    Update 1.02 - Add finish event
     
    Erel, Claudio Oliveira and ilan like this.
  10. ilan

    ilan Expert Licensed User

    Perfect thanx a lot ! :)
     
Loading...
  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