【问题标题】:How to programmatically see whats is inside a zip in android (without unzip)如何以编程方式查看 android zip 中的内容(无需解压缩)
【发布时间】:2020-02-22 05:03:30
【问题描述】:

我正在为 android 制作一个应用程序,并且需要在解压缩之前检查用户的 zip 文件条目的格式是否正确,以避免浪费时间解压缩。谁能帮帮我?

PS.:我只需要知道 zip 中文件的名称

【问题讨论】:

    标签: java android zip unzip zipfile


    【解决方案1】:

    使用ZipFile:它使用随机访问在zip存档中的文件位置之间跳转:

    try (ZipFile file = new ZipFile("file.zip")) {
        final Enumeration<? extends ZipEntry> entries = file.entries();
        while (entries.hasMoreElements()) {
            final ZipEntry entry = entries.nextElement();
            System.out.println(entry.getName());
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-03-23
      • 1970-01-01
      • 1970-01-01
      • 2016-02-03
      • 2013-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-04
      相关资源
      最近更新 更多