{"id":17044882,"url":"https://github.com/codenameone/zipsupport","last_synced_at":"2025-03-23T02:29:20.989Z","repository":{"id":148684422,"uuid":"58925195","full_name":"codenameone/ZipSupport","owner":"codenameone","description":"Simple zip/unzip library support for Codename One","archived":false,"fork":false,"pushed_at":"2017-05-29T04:21:51.000Z","size":275,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-28T05:41:41.891Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.codenameone.com/","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codenameone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-16T10:47:26.000Z","updated_at":"2020-07-08T09:57:19.000Z","dependencies_parsed_at":"2023-05-28T16:00:32.250Z","dependency_job_id":null,"html_url":"https://github.com/codenameone/ZipSupport","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FZipSupport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FZipSupport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FZipSupport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenameone%2FZipSupport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codenameone","download_url":"https://codeload.github.com/codenameone/ZipSupport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245047733,"owners_count":20552419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T09:35:48.399Z","updated_at":"2025-03-23T02:29:20.961Z","avatar_url":"https://github.com/codenameone.png","language":"Java","readme":"# Zip Support\n\nThis is a [Codename One](https://www.codenameone.com) library for Zip support based on the code from the [zipme](https://sourceforge.net/projects/zipme/) project. As such it carries a modified GPL license similar to the classpath exception but not similar enough to include in the core distribution.\n\nThis library can be used to enable ZIP functionality in Codename One applications.\n\nYou can download an install this library from [here](https://github.com/codenameone/ZipSupport/blob/master/ZipSupport.cn1lib?raw=true).\n\n\nThe sample code below demonstrates zip and unzip usage.\n\n````java\npublic Unzip(String zipName, String dirDest) {\n  InputStream is;\n  try {\n    is = Storage.getInstance().createInputStream(zipName);\n    ZipInputStream zipStream = new ZipInputStream(is);\n    ZipEntry entry;\n\n    // create a buffer to improve copy performance later.\n    byte[] buffer = new byte[2048];\n\n    while ((entry = zipStream.getNextEntry()) != null) {\n        String s = entry.getName();\n        String outdir = FileSystemStorage.getInstance().getAppHomePath();\n        if (outdir.length() \u003e 0)\n        {\n          outdir = outdir + \"/\" + dirDest;\n        }\n        String outpath = outdir + \"/\" + entry.getName();\n        OutputStream output = null;\n        try {\n          output = FileSystemStorage.getInstance().openOutputStream(outpath);\n          int len = 0;\n          while ((len = zipStream.read(buffer)) \u003e 0) {\n              output.write(buffer, 0, len);\n          }\n        } finally {\n          // we must always close the output file\n          if (output != null) {\n              output.close();\n          }\n        }\n    }\n  } catch (IOException ex) {\n      Log.p(ex.getMessage(), 0);\n  }\n}\n\n\n\npublic Unzip(InputStream zipFile, String dirDest) {\n  InputStream is;\n  try {\n    is = zipFile;\n    ZipInputStream zipStream = new ZipInputStream(is);\n    ZipEntry entry;\n\n    // create a buffer to improve copy performance later.\n    byte[] buffer = new byte[2048];\n\n    while ((entry = zipStream.getNextEntry()) != null) {\n      String s = entry.getName();\n      String outdir = FileSystemStorage.getInstance().getAppHomePath();\n      if (outdir.length() \u003e 0) {\n          outdir = outdir + \"/\" + dirDest;\n      }\n      String outpath = outdir + \"/\" + entry.getName();\n      OutputStream output = null;\n      try {\n          output = FileSystemStorage.getInstance().openOutputStream(outpath);\n          int len = 0;\n          while ((len = zipStream.read(buffer)) \u003e 0) {\n              output.write(buffer, 0, len);\n          }\n      } finally {\n          // we must always close the output file\n          if (output != null) {\n              output.close();\n          }\n      }\n    }\n  } catch (IOException ex) {\n      Log.p(ex.getMessage(), 0);\n\n  }\n}\n````\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenameone%2Fzipsupport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodenameone%2Fzipsupport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenameone%2Fzipsupport/lists"}