我查看了JDK和Apache压缩库附带的默认Zip库,我对它们不满意有三个原因:
它们臃肿不堪,API设计糟糕.我必须write 50 lines of boiler plate byte array output, zip input, file out streams and close relevant streams and catch exceptions and move byte buffers on my own?为什么我不能有一个简单的API,它看起来像
Zipper.unzip(InputStream zipFile, File targetDirectory, String password = null)
和Zipper.zip(File targetDirectory, String password = null)
,可以正常工作?压缩-解压似乎会 destruct 文件元数据,密码处理也会中断.
而且,与我在UNIX上使用的命令行zip工具相比,我try 的所有库的速度都慢了2-3倍?
对我来说(2)和(3)是次要的,但我真的希望有一个良好的测试库和一行接口.