计算ZIP目录中的文件-JAVA,Android [英] Count files in ZIP's directory - JAVA, Android

查看:79
本文介绍了计算ZIP目录中的文件-JAVA,Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个烦人的问题。如何计算Zip目录中的文件?我想避免使用 ZipFile.entries(),然后测试每个枚举。

I have a little irritating problem. How can I count files in directory in Zip? I want to avoid use ZipFile.entries() and then test every enum.

推荐答案

要计算所有文件,请使用 ZipFile.size()

To count all files use ZipFile.size().

要计算特定目录中的文件您描述的方法是唯一的选择。压缩文件的存储没有分层结构,而是带有给定文件路径的平面列表。

To count files in a specific directory the method you describe is the only option. Zip files are stored not with a hierarchical structure, just as a flat list with the file paths given.

对于这些路径是否是绝对路径(对于源来说也是如此)文件系统)或相对。

It also varies as to whether these paths are absolute (for the source file system) or relative.

这篇关于计算ZIP目录中的文件-JAVA,Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆